[PATCH 04/21] t1430: test for-each-ref in the presence of badly-named refs

2016-03-23 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- t/t1430-bad-ref-name.sh | 16 1 file changed, 16 insertions(+) diff --git a/t/t1430-bad-ref-name.sh b/t/t1430-bad-ref-name.sh index a963951..612cc32 100755 --- a/t/t1430-bad-ref-name.sh +++ b/t/t1430-bad-ref-name.sh @@ -155,6 +155,22

[PATCH 18/21] get_default_remote(): remove unneeded flag variable

2016-03-23 Thread Michael Haggerty
It is never read, so we can pass NULL to resolve_ref_unsafe(). Signed-off-by: Michael Haggerty --- builtin/submodule--helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index ed4f60b..c72365e 100644 --- a

[PATCH 02/21] t1430: clean up broken refs/tags/shadow

2016-03-23 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- t/t1430-bad-ref-name.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1430-bad-ref-name.sh b/t/t1430-bad-ref-name.sh index 005e2b1..cb815ab 100755 --- a/t/t1430-bad-ref-name.sh +++ b/t/t1430-bad-ref-name.sh @@ -148,7 +148,7

[PATCH 13/21] read_raw_ref(): manage own scratch space

2016-03-23 Thread Michael Haggerty
for different reference backends, the other implementations might have different scratch space requirements. Note that we now preserve errno across the calls to strbuf_release(), which calls free() and can thus theoretically overwrite errno. Signed-off-by: Michael Haggerty --- refs/files-backend.c

[PATCH 15/21] read_raw_ref(): change flags parameter to unsigned int

2016-03-23 Thread Michael Haggerty
now. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 120b2dd..a15986c 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1372,7 +1372,7 @@ sta

[PATCH 01/21] t1430: test the output and error of some commands more carefully

2016-03-23 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- t/t1430-bad-ref-name.sh | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/t/t1430-bad-ref-name.sh b/t/t1430-bad-ref-name.sh index c465abe..005e2b1 100755 --- a/t/t1430-bad-ref-name.sh +++ b/t/t1430-bad-ref-name.sh @@ -42,7

[PATCH 20/21] check_aliased_update(): check that dst_name is non-NULL

2016-03-23 Thread Michael Haggerty
If there is an error in resolve_ref_unsafe(), it returns NULL. We check for this case, but not until after calling strip_namespace(). Instead, call strip_namespace() *after* the NULL check. Signed-off-by: Michael Haggerty --- builtin/receive-pack.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 09/21] resolve_ref_1(): eliminate local variable

2016-03-23 Thread Michael Haggerty
In place of `buf`, use `refname`, which is anyway a better description of what is being pointed at. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index

[PATCH 16/21] fsck_head_link(): remove unneeded flag variable

2016-03-23 Thread Michael Haggerty
It is never read, so we can pass NULL to resolve_ref_unsafe(). Signed-off-by: Michael Haggerty --- builtin/fsck.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/fsck.c b/builtin/fsck.c index 55eac75..3f27456 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c

[PATCH 08/21] resolve_ref_unsafe(): ensure flags is always set

2016-03-23 Thread Michael Haggerty
If the caller passes flags==NULL, then set it to point at a local scratch variable. This removes the need for a lot of "if (flags)" guards in resolve_ref_1() and resolve_missing_loose_ref(). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 31 +

[PATCH 10/21] resolve_ref_1(): reorder code

2016-03-23 Thread Michael Haggerty
There is no need to adjust *flags if we're just about to fail. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 69ec903..60f1493 100644 --- a/refs/files-back

[PATCH 11/21] resolve_ref_1(): eliminate local variable "bad_name"

2016-03-23 Thread Michael Haggerty
We can use (*flags & REF_BAD_NAME) for that purpose. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 60f1493..b865ba5 100644 --- a/refs/files-backe

[PATCH 14/21] Inline resolve_ref_1() into resolve_ref_unsafe()

2016-03-23 Thread Michael Haggerty
resolve_ref_unsafe() wasn't doing anything useful anymore. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 31 +-- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index f752568..120b2dd 1

Re: [PATCH v7 04/33] files-backend: break out ref reading

2016-03-23 Thread Michael Haggerty
On 03/01/2016 01:52 AM, David Turner wrote: > Refactor resolve_ref_1 in terms of a new function read_raw_ref, which > is responsible for reading ref data from the ref storage. > > Later, we will make read_raw_ref a pluggable backend function, and make > resolve_ref_unsafe common. > > Testing done

Re: [PATCH v7 09/33] refs: reduce the visibility of do_for_each_ref()

2016-03-24 Thread Michael Haggerty
On 03/01/2016 01:52 AM, David Turner wrote: > From: Ramsay Jones > > Now that we have moved do_for_each_ref into refs.c, it no longer needs > to be public. > > Signed-off-by: Ramsay Jones > Signed-off-by: Junio C Hamano > --- > refs.c | 19 +++ > refs/refs-intern

Re: [PATCH v7 14/33] refs: add methods to init refs db

2016-03-24 Thread Michael Haggerty
On 03/01/2016 01:52 AM, David Turner wrote: > Alternate refs backends might not need the refs/heads directory and so > on, so we make ref db initialization part of the backend. > > Signed-off-by: David Turner > Signed-off-by: Junio C Hamano > --- > builtin/init-db.c| 20 ++--

Re: [PATCH v7 17/33] refs: make lock generic

2016-03-24 Thread Michael Haggerty
On 03/01/2016 01:52 AM, David Turner wrote: > Instead of using a files-backend-specific struct ref_lock, the generic > ref_transaction struct should provide a void pointer that backends can use > for their own lock data. Aside from the comments I've already mentioned, I've checked the patches up t

Re: [PATCH 00/21] replacement for dt/refs-backend-lmdb v7 patch 04/33

2016-03-26 Thread Michael Haggerty
On 03/24/2016 07:47 AM, David Turner wrote: > [...] > I incorporated your changes into the lmdb backend. To make merging > later more convenient, I rebased on top of pu -- I think this mainly > depends on jk/check-repository-format, but I also included some fixes > for a couple of tests that had b

Re: [PATCH 00/21] replacement for dt/refs-backend-lmdb v7 patch 04/33

2016-03-29 Thread Michael Haggerty
On 03/29/2016 10:12 PM, David Turner wrote: > On Sun, 2016-03-27 at 07:22 +0200, Michael Haggerty wrote: >> On 03/24/2016 07:47 AM, David Turner wrote: >>> [...] >>> I incorporated your changes into the lmdb backend. To make merging >>> later more convenien

RFC: New reference iteration paradigm

2016-03-31 Thread Michael Haggerty
Currently the way to iterate over references is via a family of for_each_ref()-style functions. You pass some arguments plus a callback function and cb_data to the function, and your callback is called for each reference that is selected. This works, but it has two big disadvantages: 1. It is cum

Re: [PATCH 00/21] replacement for dt/refs-backend-lmdb v7 patch 04/33

2016-03-31 Thread Michael Haggerty
On 03/30/2016 10:05 PM, David Turner wrote: > On Wed, 2016-03-30 at 08:37 +0200, Michael Haggerty wrote: >> On 03/29/2016 10:12 PM, David Turner wrote: >>> On Sun, 2016-03-27 at 07:22 +0200, Michael Haggerty wrote: >>>> On 03/24/2016 07:47 AM, David Turner wrote: &g

Re: [PATCH 03/24] t1430: test the output and error of some commands more carefully

2016-04-08 Thread Michael Haggerty
On 04/07/2016 03:02 PM, David Turner wrote: > From: Michael Haggerty > > Signed-off-by: Michael Haggerty > [...] David, even though I wrote these patches, I believe you need to sign them off too since you are the one submitting them to the list (it's a chain-of-custody sort

Re: [PATCH 00/24] Yet another pre-refs-backend series

2016-04-09 Thread Michael Haggerty
On 04/07/2016 03:02 PM, David Turner wrote: > We now have quite a large number of patches before we even get into > the meat of the pluggable refs backend series. So it's worth breaking > those out and getting them in before we get into the main series > (which Michael Haggerty s

Re: Parallel checkout (Was Re: 0 bot for Git)

2016-04-15 Thread Michael Haggerty
On 04/15/2016 06:52 PM, Jeff King wrote: > On Fri, Apr 15, 2016 at 01:18:46PM +0200, Christian Couder wrote: > >> On Fri, Apr 15, 2016 at 11:51 AM, Duy Nguyen wrote: >>> On Fri, Apr 15, 2016 at 12:04:49AM +0200, Christian Couder wrote: There is a draft of an article about the first part

Re: [PATCH v7 19/33] refs: allow log-only updates

2016-04-21 Thread Michael Haggerty
On 03/01/2016 01:52 AM, David Turner wrote: > The refs infrastructure learns about log-only ref updates, which only > update the reflog. Later, we will use this to separate symbolic > reference resolution from ref updating. > > Signed-off-by: David Turner > Signed-off-by: Junio C Hamano > --- >

Re: [git-multimail] smtplib, check certificate

2016-04-21 Thread Michael Haggerty
On 04/22/2016 08:05 AM, Matthieu Moy wrote: > Simon P writes: > > This patch is inspired from > > > > https://github.com/graingert/secure-smtplib/blob/master/src/secure_smtplib/__init__.py > > Please, add your sign-off and a proper commit message to your patch, > see: > > https://github.com/git

[PATCH 16/29] ref_transaction_commit(): correctly report close_ref() failure

2016-04-27 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- close() rarely fails, but it is possible. refs/files-backend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/refs/files-backend.c b/refs/files-backend.c index 8fcbd7d..e86e3de 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3144,6

[PATCH 06/29] commit_ref_update(): write error message to *err, not stderr

2016-04-27 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 1f38076..de38517 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2686,7 +2686,7 @@ static int

[PATCH 21/29] add_update(): initialize the whole ref_update

2016-04-27 Thread Michael Haggerty
Change add_update() to initialize all of the fields in the new ref_update object. Rename the function to ref_transaction_add_update(), and increase its visibility to all of the refs-related code. All of this makes the function more useful for other future callers. Signed-off-by: Michael Haggerty

[PATCH 18/29] refs: allow log-only updates

2016-04-27 Thread Michael Haggerty
From: David Turner The refs infrastructure learns about log-only ref updates, which only update the reflog. Later, we will use this to separate symbolic reference resolution from ref updating. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty

[PATCH 12/29] read_raw_ref(): improve docstring

2016-04-27 Thread Michael Haggerty
Among other things, document the (important!) requirement that input refname be checked for safety before calling this function. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 41 - 1 file changed, 24 insertions(+), 17 deletions(-) diff --git

[PATCH 05/29] refname_is_safe(): insist that the refname already be normalized

2016-04-27 Thread Michael Haggerty
The reference name is going to be compared to other reference names, so it should be in its normalized form. Signed-off-by: Michael Haggerty --- Does anybody have a use case for allowing un-normalized reference names like "refs/foo/../bar///baz"? I'm pretty certain they would

[PATCH 13/29] lock_ref_sha1_basic(): remove unneeded local variable

2016-04-27 Thread Michael Haggerty
resolve_ref_unsafe() can cope with being called with NULL passed to its flags argument. So lock_ref_sha1_basic() can just hand its own type parameter through. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a

[PATCH 08/29] ref_transaction_commit(): remove local variable n

2016-04-27 Thread Michael Haggerty
ff-by: Michael Haggerty --- refs/files-backend.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 0ade681..05797cb 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3043,7 +3043,6 @

[PATCH 26/29] lock_ref_for_update(): don't re-read non-symbolic references

2016-04-27 Thread Michael Haggerty
e the read_ref_full() call into the (update->type & REF_ISSYMREF) block. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 52 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/refs/files-backend.c b/refs/files-bac

[PATCH 20/29] verify_refname_available(): adjust constness in declaration

2016-04-27 Thread Michael Haggerty
The two string_list arguments can be const. Signed-off-by: Michael Haggerty --- This is needed because I want to add a new caller that has const versions of these lists in hand. refs/files-backend.c | 4 ++-- refs/refs-internal.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff

[PATCH 03/29] refname_is_safe(): use skip_prefix()

2016-04-27 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/refs.c b/refs.c index 87dc82f..5789152 100644 --- a/refs.c +++ b/refs.c @@ -120,17 +120,19 @@ int check_refname_format(const char *refname, int flags) int refname_is_safe

[PATCH 23/29] unlock_ref(): move definition higher in the file

2016-04-27 Thread Michael Haggerty
This avoids the need for a forward declaration in the next patch. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 546656a..8f2a795 100644 --- a

[PATCH 29/29] lock_ref_sha1_basic(): only handle REF_NODEREF mode

2016-04-27 Thread Michael Haggerty
_lock::orig_ref_name * Remove local variable orig_refname from lock_ref_sha1_basic() * commit_ref_update() never has to write to the reflog for lock->orig_ref_name Signed-off-by: Michael Haggerty --- refs/files-backend.c | 54 1 file cha

[PATCH 04/29] refname_is_safe(): don't allow the empty string

2016-04-27 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- This fixes a coding error from the original implementation. refs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index 5789152..ca0280f 100644 --- a/refs.c +++ b/refs.c @@ -136,11 +136,12 @@ int refname_is_safe(const

[PATCH 11/29] read_raw_ref(): rename symref argument to referent

2016-04-27 Thread Michael Haggerty
After all, it doesn't hold the symbolic reference, but rather the reference referred to. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 21 +++-- refs/refs-internal.h | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/refs/files-backen

[PATCH 02/29] remove_dir_recursively(): add docstring

2016-04-27 Thread Michael Haggerty
Add a docstring for the remove_dir_recursively() function and the REMOVE_DIR_* flags that can be passed to it. Signed-off-by: Michael Haggerty --- dir.h | 23 +++ 1 file changed, 23 insertions(+) diff --git a/dir.h b/dir.h index 301b737..5f19acc 100644 --- a/dir.h +++ b

[PATCH 15/29] ref_transaction_create(): disallow recursive pruning

2016-04-27 Thread Michael Haggerty
It is nonsensical (and a little bit dangerous) to use REF_ISPRUNING without REF_NODEREF. Forbid it explicitly. Change the one REF_ISPRUNING caller to pass REF_NODEREF too. Signed-off-by: Michael Haggerty --- This also makes later patches a bit clearer. refs.c | 3 +++ refs/files

[PATCH 01/29] safe_create_leading_directories(): improve docstring

2016-04-27 Thread Michael Haggerty
Document the difference between this function and safe_create_leading_directories_const(), and that the former restores path before returning. Signed-off-by: Michael Haggerty --- cache.h | 5 + 1 file changed, 5 insertions(+) diff --git a/cache.h b/cache.h index 2711048..4134f64 100644

[PATCH 14/29] refs: make error messages more consistent

2016-04-27 Thread Michael Haggerty
* Always start error messages with a lower-case letter. * Always enclose reference names in single quotes. Signed-off-by: Michael Haggerty --- This change is not strictly needed, but I wanted to fix the old error messages before I started adding new ones (otherwise, should the new error

[PATCH 17/29] delete_branches(): use resolve_refdup()

2016-04-27 Thread Michael Haggerty
The return value of resolve_ref_unsafe() is not guaranteed to stay around as long as we need it, so use resolve_refdup() instead. Signed-off-by: Michael Haggerty --- builtin/branch.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/builtin/branch.c b

[PATCH 28/29] commit_ref_update(): remove the flags parameter

2016-04-27 Thread Michael Haggerty
commit_ref_update() is now only called with flags=0. So remove the flags parameter entirely. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 40ed157

[PATCH 25/29] refs: resolve symbolic refs first

2016-04-27 Thread Michael Haggerty
flogs for symbolic references if there is a concurrent update by another process, since the old_oid of a symref is determined before the lock on the pointed-to ref is held. Both problems will soon be fixed. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Mi

[PATCH 19/29] refs: don't dereference on rename

2016-04-27 Thread Michael Haggerty
roken symref would use the pointed-to ref name for the moved reflog. Add a test for the reflog bug. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs/files-backend.c | 13 - t/t3200-branch.sh| 9 + 2 files change

[PATCH 07/29] rename_ref(): remove unneeded local variable

2016-04-27 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index de38517..0ade681 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2351,20 +2351,17 @@ int

[PATCH 27/29] lock_ref_for_update(): don't resolve symrefs

2016-04-27 Thread Michael Haggerty
in the old code, the old_sha1 of the symref was resolved before the reference that it pointed at was locked. So it was possible that the old_sha1 value logged to the symref's reflog could be wrong if another process changed the downstream reference before it was locked. Signed-off-by: Michael Ha

[PATCH 24/29] ref_transaction_update(): check refname_is_safe() at a minimum

2016-04-27 Thread Michael Haggerty
If the user has asked that a new value be set for a reference, we use check_refname_format() to verify that the reference name satisfies all of the rules. But in other cases, at least check that refname_is_safe(). Signed-off-by: Michael Haggerty --- There are remaining problems in this area of

[PATCH 00/29] Yet more preparation for reference backends

2016-04-27 Thread Michael Haggerty
l.git/287949/focus=287958 [3] http://article.gmane.org/gmane.comp.version-control.git/282927 [4] https://github.com/mhagger/git David Turner (2): refs: allow log-only updates refs: don't dereference on rename Michael Haggerty (27): safe_create_leading_directories(): improve docstring

[PATCH 22/29] lock_ref_for_update(): new function

2016-04-27 Thread Michael Haggerty
Extract a new function, lock_ref_for_update(), from ref_transaction_commit(). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 152 --- 1 file changed, 85 insertions(+), 67 deletions(-) diff --git a/refs/files-backend.c b/refs/files

[PATCH 10/29] read_raw_ref(): clear *type at start of function

2016-04-27 Thread Michael Haggerty
This is more convenient and less error-prone for callers. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/refs/files-backend.c b/refs/files-backend.c index 303c43b..f10c80f 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c

[PATCH 09/29] read_raw_ref(): rename flags argument to type

2016-04-27 Thread Michael Haggerty
This will hopefully reduce confusion with the "flags" arguments that are used in many functions in this module as an input parameter to choose how the function should operate. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 16 refs/refs-internal.h | 2 +

Re: [PATCH 15/29] ref_transaction_create(): disallow recursive pruning

2016-04-28 Thread Michael Haggerty
On 04/27/2016 11:15 PM, Junio C Hamano wrote: > Junio C Hamano writes: > >> If a casual reader sees this code: >> >> ref_transaction_delete(transaction, r->name, r->sha1, >> REF_ISPRUNING | REF_NODEREF, NULL, &err) >> >> it gives an incorrect impression that there may

Re: [PATCH 19/29] refs: don't dereference on rename

2016-04-29 Thread Michael Haggerty
On 04/27/2016 08:55 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> @@ -2380,8 +2381,8 @@ int rename_ref(const char *oldrefname, const char >> *newrefname, const char *logms >> goto rollback; >> } >> >> -if (!read_ref_

Re: [PATCH 24/29] ref_transaction_update(): check refname_is_safe() at a minimum

2016-04-29 Thread Michael Haggerty
On 04/27/2016 10:14 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> If the user has asked that a new value be set for a reference, we use >> check_refname_format() to verify that the reference name satisfies all >> of the rules. But in other cases, at least ch

Re: [PATCH 25/29] refs: resolve symbolic refs first

2016-04-29 Thread Michael Haggerty
On 04/29/2016 01:40 AM, David Turner wrote: > On Wed, 2016-04-27 at 18:57 +0200, Michael Haggerty wrote: > +retry: > ... >> +if (--attempts_remaining > 0) >> +goto retry; > > could this be a loop instead of using gotos? It cer

Re: [PATCH 19/29] refs: don't dereference on rename

2016-04-29 Thread Michael Haggerty
On 04/29/2016 10:53 AM, Junio C Hamano wrote: > Michael Haggerty writes: > >>> Could you explain s/sha1/NULL/ here in the proposed log message? >> >> Good question. >> >> Passing sha1 to delete_ref() doesn't add any safety, because the same >>

Re: [PATCH 19/29] refs: don't dereference on rename

2016-04-29 Thread Michael Haggerty
On 04/29/2016 02:12 PM, Jeff King wrote: > On Fri, Apr 29, 2016 at 12:57:29PM +0200, Michael Haggerty wrote: > >> Remember, we're talking about rename_ref() only, not reference deletion >> in general. rename_ref() is not very robust anyway--it doesn't happen in >&g

Re: [PATCH 15/29] ref_transaction_create(): disallow recursive pruning

2016-04-29 Thread Michael Haggerty
On 04/29/2016 10:41 AM, Junio C Hamano wrote: > [...Long, thoughtful comments omitted...] > So perhaps your original might be the best version > among those that have been discussed in this thread. Very well. I'll also add a comment near the definition of REF_ISPRUNING that it must only be used to

Re: [PATCH 19/29] refs: don't dereference on rename

2016-04-29 Thread Michael Haggerty
On 04/30/2016 01:21 AM, David Turner wrote: > On Fri, 2016-04-29 at 09:38 +0200, Michael Haggerty wrote: >> On 04/27/2016 08:55 PM, Junio C Hamano wrote: >>> Michael Haggerty writes: >>> >>>> @@ -2380,8 +2381,8 @@ int rename_ref(const char *oldrefname,

Re: [PATCH v2 38/43] refs: make some files backend functions public

2015-10-07 Thread Michael Haggerty
On 10/07/2015 03:25 AM, David Turner wrote: > On Mon, 2015-10-05 at 11:03 +0200, Michael Haggerty wrote: >> On 09/29/2015 12:02 AM, David Turner wrote: >>> Because HEAD and stash are per-worktree, other backends need to >>> go through the files backend to manage t

Re: [PATCH v2 42/43] refs: add LMDB refs backend

2015-10-07 Thread Michael Haggerty
On 10/07/2015 03:51 AM, David Turner wrote: > On Mon, 2015-10-05 at 17:47 +0200, Michael Haggerty wrote: >> On 09/29/2015 12:02 AM, David Turner wrote: >>> Add a database backend for refs using LMDB. [...] >> >> I think you have said before that if one writer hol

Re: [PATCH v2 42/43] refs: add LMDB refs backend

2015-10-07 Thread Michael Haggerty
On 10/07/2015 09:20 PM, David Turner wrote: > On Wed, 2015-10-07 at 20:31 +0200, Michael Haggerty wrote: >> [...] >> I'm really happy about your work. >> >> Regarding strategy: I think a good approach would be to get as much of >> the preparatory work as possi

Re: [PATCH v2 38/43] refs: make some files backend functions public

2015-10-07 Thread Michael Haggerty
On 10/07/2015 10:55 PM, David Turner wrote: > On Wed, 2015-10-07 at 18:00 +0200, Michael Haggerty wrote: >> >> That's a really good point. >> >> I hate to break it to you, but the handling of symrefs in Git is already >> a mess. HEAD is the only sy

Re: [PATCH v3 01/44] refs.c: create a public version of verify_refname_available

2015-10-12 Thread Michael Haggerty
; +int verify_refname_available(const char *newname, struct string_list *extra, > + struct string_list *skip, struct strbuf *err); This function has an `extra` parameter but the description of this parameter disappeared as the docstring was moved from refs.c to here. > + > +/* > * Flags controlling ref_transaction_update(), ref_transaction_create(), etc. > * REF_NODEREF: act on the ref directly, instead of dereferencing > * symbolic references. > Michael -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v3 02/44] refs: make repack_without_refs and is_branch public

2015-10-12 Thread Michael Haggerty
ultimately end up in refs.h) given that it intrinsically only has to do with file-based references. But I will read on... Michael -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.o

Re: [PATCH v3 05/44] refs.c: move update_ref to refs.c

2015-10-12 Thread Michael Haggerty
t; + } > + > + if (old_sha1) { > + unsigned char actual_old_sha1[20]; > + read_ref(pseudoref, actual_old_sha1); The original read if (read_ref(pseudoref, actual_old_sha1)) die("could not read ref '%s'&

Re: [PATCH v3 06/44] refs.c: move delete_ref and delete_refs to the common code

2015-10-12 Thread Michael Haggerty
as in the previous patch. The original was if (read_ref(pseudoref, actual_old_sha1)) die("could not read ref '%s'", pseudoref); > + if (hashcmp(actual_old_sha1, old_sha1)) { > + warning("Unexpected sha1 when deleting %s",

Re: [PATCH v3 16/44] refs.c: move ref iterators to the common code

2015-10-12 Thread Michael Haggerty
ern, '/'); in place of the above two lines. I think you made a mistake when rebasing on top of 00b6c178c3 use strbuf_complete to conditionally append slash > + /* No need to check for '*', there is none. */ > + strbuf_addch(&real_pa

Re: [PATCH v3 18/44] refs: move transaction functions into common code

2015-10-12 Thread Michael Haggerty
ane.org/gmane.comp.version-control.git/279049 [2] https://github.com/mhagger/git -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v3 02/44] refs: make repack_without_refs and is_branch public

2015-10-13 Thread Michael Haggerty
On 10/13/2015 04:39 AM, Michael Haggerty wrote: > On 10/12/2015 11:51 PM, David Turner wrote: >> is_branch was already non-static, but this patch declares it in the >> header. >> >> Signed-off-by: Ronnie Sahlberg >> Signed-off-by: David Turner >&

Re: [PATCH v3 25/44] refs.h: document make refname_is_safe and add it to header

2015-10-13 Thread Michael Haggerty
c references. > The previous commit deleted this comment from where it previously appeared in refs-be-files.c. It would make more sense to squash this commit onto that one so it's clear that you are moving the comment rather than creating a new comment out of thin air. Mich

Re: [PATCH v3 20/44] refs-be-files.c: add methods for misc ref operations

2015-10-13 Thread Michael Haggerty
hunks from the subsequent commit is needed in this commit. Michael -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v3 19/44] refs-be-files.c: add a backend method structure with transaction functions

2015-10-13 Thread Michael Haggerty
_be_files is needed in the public interface. > +int set_refs_backend(const char *name); > + > #endif /* REFS_H */ Michael -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v3 25/44] refs.h: document make refname_is_safe and add it to header

2015-10-13 Thread Michael Haggerty
On 10/13/2015 09:33 AM, Michael Haggerty wrote: > On 10/12/2015 11:51 PM, David Turner wrote: >> This function might be used by other refs backends >> >> Signed-off-by: David Turner >> --- >> refs.h | 11 +++ >> 1 file changed, 11 insertions(+) >

Re: [PATCH v3 26/44] refs.c: move copy_msg to the common code

2015-10-13 Thread Michael Haggerty
enum ref_type ref_type(const char *refname); > > +int copy_reflog_msg(char *buf, const char *msg); > + > enum expire_reflog_flags { > EXPIRE_REFLOGS_DRY_RUN = 1 << 0, > EXPIRE_REFLOGS_UPDATE_REF = 1 << 1, > Michael -- Michael Haggerty mhag...@alum.mit.edu --

Re: [PATCH v3 27/44] refs.c: move peel_object to the common code

2015-10-13 Thread Michael Haggerty
L_BROKEN = -4 > +}; > + > +enum peel_status peel_object(const unsigned char *name, unsigned char *sha1); > + > /** > * Resolve refname in the nested "gitlink" repository that is located > * at path. If the resolution is successful, return 0 and set sha1 to > Michael -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v3 37/44] refs: break out a ref conflict check

2015-10-13 Thread Michael Haggerty
cate a new string, copy refname to it, append a '/', then free the string again when it's done. Alternatively, it could accept its refname argument in a strbuf and temporarily append the '/'. But neither one of these alternatives is so elegant, so maybe it's OK if

Re: [PATCH v3 18/44] refs: move transaction functions into common code

2015-10-13 Thread Michael Haggerty
e seven because I squashed the first two together). Michael [1] http://article.gmane.org/gmane.comp.version-control.git/279286 [2] https://github.com/mhagger/git -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in the b

Re: [PATCH v3 01/13] refs: convert some internal functions to use object_id

2015-10-13 Thread Michael Haggerty
ersion-control.git/279496 -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v3 19/44] refs-be-files.c: add a backend method structure with transaction functions

2015-10-13 Thread Michael Haggerty
On 10/13/2015 08:28 PM, David Turner wrote: > On Tue, 2015-10-13 at 09:56 +0200, Michael Haggerty wrote: >> On 10/12/2015 11:51 PM, David Turner wrote: >>> [...] >>> +extern struct ref_be refs_be_files; >> >> I don't think that refs_be_files is

Re: [PATCH v4 02/26] refs: make repack_without_refs and is_branch public

2015-10-15 Thread Michael Haggerty
y_refname_available(const char *newname, struct string_list *extra, >struct string_list *skip, struct strbuf *err); > > +extern int is_branch(const char *refname); > + > /* > * Flags controlling ref_transaction_update(), ref_transaction_create()

Re: [PATCH v4 03/26] refs-be-files.c: rename refs to refs-be-files

2015-10-15 Thread Michael Haggerty
y > around is because the code that will eventually remain in this new > refs-be-files.c file is so entangled that it would then be very > difficult to break the split up into small independent patches/chunks. > [...] Michael -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscrib

Re: [PATCH 0/5] Remove unused #include "sigchain.h"

2015-10-26 Thread Michael Haggerty
Thanks for cleaning these up, Tobias. I totally forgot to look for includes that were no longer needed. Michael -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v5 16/26] refs.c: move ref iterators to the common code

2015-10-31 Thread Michael Haggerty
fn fn, > void *cb_data) > -{ > - return for_each_ref_in_submodule(submodule, "refs/remotes/", fn, > cb_data); > -} > - > int for_each_replace_ref(each_ref_fn fn, void *cb_data) > { > return do_for_each_ref(&ref_cache, git_replace_ref_base, fn, Nit: y

Re: [PATCH v5 18/26] refs: move transaction functions into common code

2015-11-01 Thread Michael Haggerty
efs-be-files.c refs/refs-be-lmdb.c <- still to come What would you think of that? Michael [1] We've discussed this idea earlier, using the tentative names refs-shared.h or refs-common.h. -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line &qu

Re: [PATCH v5 25/26] refs: break out ref conflict checks

2015-11-02 Thread Michael Haggerty
d-off-by: Junio C Hamano > Signed-off-by: Michael Haggerty > --- > refs-be-files.c | 49 - > refs.c | 38 ++ > refs.h | 15 +++ > 3 files changed, 61 insertions(+),

Re: [PATCH v5 00/26] refs backend pre-vtable

2015-11-02 Thread Michael Haggerty
version shortly as v6. Otherwise it all looks good. I've checked everything rather carefully and didn't find any problems. Thanks for your patience! Michael [1] https://github.com/mhagger/git -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line &

[PATCH v6 13/25] refs: move is_branch to the common code

2015-11-02 Thread Michael Haggerty
From: Ronnie Sahlberg Signed-off-by: Ronnie Sahlberg Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs/files-backend.c | 5 - refs/refs.c | 5 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/refs/files

[PATCH v6 16/25] refs: move head_ref_namespaced to the common code

2015-11-02 Thread Michael Haggerty
From: Ronnie Sahlberg Signed-off-by: Ronnie Sahlberg Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs/files-backend.c | 15 --- refs/refs.c | 15 +++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/refs/files-backend.c b

[PATCH v6 18/25] refs: move refname_is_safe to the common code

2015-11-02 Thread Michael Haggerty
David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs/files-backend.c | 33 - refs/refs-internal.h | 15 +++ refs/refs.c | 24 3 files changed, 39 insertions(+), 33 deletions(-) diff --

[PATCH v6 11/25] refs: move resolve_refdup to common

2015-11-02 Thread Michael Haggerty
From: Ronnie Sahlberg This function can be shared across all refs backends so move it to the common code. Signed-off-by: Ronnie Sahlberg Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs/files-backend.c | 7 --- refs/refs.c | 7

[PATCH v6 00/25] refs backend pre-vtable

2015-11-02 Thread Michael Haggerty
This is a proposed revision of David Turner's refs-backend-pre-vtable v5 [1]. It incorporates all of the changes I suggested when reviewing that series, plus it moves the refs-related code to a subdirectory and creates a new header file refs/refs-internal.h for declarations meant to be used within

[PATCH v6 14/25] refs: move prettify_refname to the common code

2015-11-02 Thread Michael Haggerty
From: Ronnie Sahlberg Signed-off-by: Ronnie Sahlberg Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs/files-backend.c | 9 - refs/refs.c | 9 + 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/refs/files-backend.c b/refs/files

[PATCH v6 01/25] refs: make is_branch public

2015-11-02 Thread Michael Haggerty
From: David Turner is_branch was already non-static, but this patch declares it in the header. Signed-off-by: Ronnie Sahlberg Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/refs.h b

[PATCH v6 12/25] refs: move check_refname_format to the common code

2015-11-02 Thread Michael Haggerty
From: Ronnie Sahlberg This function does not contain any backend specific code so move it to the common code. Signed-off-by: Ronnie Sahlberg Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs/files-backend.c | 109

<    3   4   5   6   7   8   9   10   11   12   >