[PATCH 11/13] initial_ref_transaction_commit(): check for duplicate refs

2015-06-08 Thread Michael Haggerty
Error out if the ref_transaction includes more than one update for any refname. Signed-off-by: Michael Haggerty --- refs.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/refs.c b/refs.c index b103a4b..ced4e53 100644 --- a/refs.c +++ b/refs.c @@ -4064,12 +4064,22 @@ int

[PATCH 06/13] delete_refs(): convert error message to lower case

2015-06-08 Thread Michael Haggerty
This string is going to have to be re-internationalized anyway because of the previous commit. So while we're at it, we might as well convert it to lower case as per our usual practice. Signed-off-by: Michael Haggerty --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 07/13] prune_remote(): use delete_refs()

2015-06-08 Thread Michael Haggerty
This will result in errors being emitted for references that can't be deleted, but that is a good thing. Signed-off-by: Michael Haggerty --- builtin/remote.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index c8

[PATCH 04/13] delete_refs(): new function for the refs API

2015-06-08 Thread Michael Haggerty
Move the function remove_branches() from builtin/remote.c to refs.c, rename it to delete_refs(), and make it public. Signed-off-by: Michael Haggerty --- builtin/remote.c | 21 + refs.c | 19 +++ refs.h | 7 +++ 3 files changed, 27

[PATCH 00/13] Improve "refs" module encapsulation

2015-06-08 Thread Michael Haggerty
er need to care about the distinction between loose and packed references. These patches are also available from my GitHub account [1] as branch "init-delete-refs-api". [1] https://github.com/mhagger/git Michael Haggerty (13): delete_ref(): move declaration to refs.h remove_branches

[PATCH 09/13] initial_ref_transaction_commit(): function for initial ref creation

2015-06-08 Thread Michael Haggerty
, the function trusts its caller to only call it when it makes sense. Future commits will add some more limited sanity checks. Signed-off-by: Michael Haggerty --- builtin/clone.c | 19 +++ refs.c | 47 +++ refs.h | 14 +

[PATCH 12/13] initial_ref_transaction_commit(): check for ref D/F conflicts

2015-06-08 Thread Michael Haggerty
e shouldn't *be* any existing references when this function is called. But, at least in the case of the "testgit" remote helper, "clone" can be called after the remote-tracking "HEAD" and "master" branches have already been created. So let's just

[PATCH 05/13] delete_refs(): improve error message

2015-06-08 Thread Michael Haggerty
Change the error message from Could not remove branch %s to Could not remove reference %s This change makes sense even for the existing caller, which uses the function to delete remote-tracking branches. Signed-off-by: Michael Haggerty --- refs.c | 2 +- 1 file changed, 1 insertion

[PATCH 02/13] remove_branches(): remove temporary

2015-06-08 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- builtin/remote.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index f4a6ec9..53b8e13 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -756,8 +756,7 @@ static int remove_branches(struct

[PATCH 10/13] refs: remove some functions from the module's public interface

2015-06-08 Thread Michael Haggerty
difference between loose and packed references. Signed-off-by: Michael Haggerty --- refs.c | 31 --- refs.h | 30 -- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/refs.c b/refs.c index ec4b8a0..b103a4b 100644 --- a/refs.c

[PATCH 13/13] refs: move the remaining ref module declarations to refs.h

2015-06-08 Thread Michael Haggerty
Some functions from the refs module were still declared in cache.h. Move them to refs.h. Add some parameter names where they were missing. Signed-off-by: Michael Haggerty --- archive.c | 1 + builtin/blame.c | 1 + builtin/fast-export.c | 1 + builtin/fmt-merge

[PATCH 1/2] fsck_handle_reflog_sha1(): new function

2015-06-08 Thread Michael Haggerty
New function, extracted from fsck_handle_reflog_ent(). The extra is_null_sha1() test for the new reference is currently unnecessary, as reflogs are deleted when the reference itself is deleted. But it doesn't hurt, either. Signed-off-by: Michael Haggerty --- builtin/fsck.c

[PATCH 2/2] fsck: report errors if reflog entries point at invalid objects

2015-06-08 Thread Michael Haggerty
Previously, if a reflog entry's old or new SHA-1 was not resolvable to an object, that SHA-1 was silently ignored. Instead, report such cases as errors. Signed-off-by: Michael Haggerty --- builtin/fsck.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bu

[PATCH 0/2] fsck: don't ignore broken reflog entries

2015-06-08 Thread Michael Haggerty
com/mhagger/git Michael Haggerty (2): fsck_handle_reflog_sha1(): new function fsck: report errors if reflog entries point at invalid objects builtin/fsck.c | 34 -- 1 file changed, 20 insertions(+), 14 deletions(-) -- 2.1.4 -- To unsubscribe from this list

Re: [PATCH 2/2] fsck: report errors if reflog entries point at invalid objects

2015-06-08 Thread Michael Haggerty
On 06/08/2015 04:27 PM, Johannes Schindelin wrote: > On 2015-06-08 08:40, Michael Haggerty wrote: >> Previously, if a reflog entry's old or new SHA-1 was not resolvable >> to an object, that SHA-1 was silently ignored. Instead, report such >> cases as errors. > >

Re: [PATCH 1/2] fsck_handle_reflog_sha1(): new function

2015-06-08 Thread Michael Haggerty
On 06/08/2015 05:07 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> New function, extracted from fsck_handle_reflog_ent(). The extra >> is_null_sha1() test for the new reference is currently unnecessary, as >> reflogs are deleted when the reference itself is de

Re: [PATCH 01/13] delete_ref(): move declaration to refs.h

2015-06-09 Thread Michael Haggerty
On 06/08/2015 06:43 PM, Stefan Beller wrote: > On Mon, Jun 8, 2015 at 4:45 AM, Michael Haggerty wrote: >> [...] >> +/* >> + * Delete the specified reference. If old_sha1 is non-NULL and not >> + * NULL_SHA1, then verify that the current value of the reference is >>

Re: [PATCH 03/13] delete_ref(): handle special case more explicitly

2015-06-09 Thread Michael Haggerty
On 06/08/2015 06:48 PM, Stefan Beller wrote: > On Mon, Jun 8, 2015 at 4:45 AM, Michael Haggerty wrote: >> delete_ref() uses a different convention for its old_sha1 parameter >> than, say, ref_transaction_delete(): NULL_SHA1 means not to check the >> old value. Make this fact

Re: [PATCH 06/13] delete_refs(): convert error message to lower case

2015-06-09 Thread Michael Haggerty
On 06/08/2015 06:51 PM, Stefan Beller wrote: > On Mon, Jun 8, 2015 at 4:45 AM, Michael Haggerty wrote: >> This string is going to have to be re-internationalized anyway because >> of the previous commit. So while we're at it, we might as well convert >> it to lower case

Re: [PATCH 07/13] prune_remote(): use delete_refs()

2015-06-09 Thread Michael Haggerty
On 06/08/2015 07:12 PM, Jeff King wrote: > On Mon, Jun 08, 2015 at 09:57:04AM -0700, Stefan Beller wrote: > >> On Mon, Jun 8, 2015 at 4:45 AM, Michael Haggerty >> wrote: >>> This will result in errors being emitted for references that can't be >>> dele

Re: [PATCH 02/14] tempfile: a new module for handling temporary files

2015-06-10 Thread Michael Haggerty
On 06/10/2015 07:36 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> diff --git a/builtin/add.c b/builtin/add.c >> index df5135b..aaa9ce4 100644 >> --- a/builtin/add.c >> +++ b/builtin/add.c >> @@ -5,6 +5,7 @@ >> */ >> #include

Re: [PATCH 3/8] Convert struct ref to use object_id.

2015-06-11 Thread Michael Haggerty
; **local_tail = ref; > *local_tail = &ref->next; > [...] > diff --git a/transport-helper.c b/transport-helper.c > index 5d99a6b..4ca3e80 100644 > --- a/transport-helper.c > +++ b/transport-helper.c > [...] > @@ -883,7 +883,7 @@ static int push_refs_with_exp

Re: [PATCH 4/8] Add a utility function to make parsing hex values easier.

2015-06-11 Thread Michael Haggerty
nction would want to return 0 on *error*. Which is another disadvantage of this style. All the code that called get_sha1_hex() had to treat 0 as success. With your function they would have to be inverted to treat 0 as failure. I think this would cause confusion. > [...] 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 0/8] object_id part 2

2015-06-13 Thread Michael Haggerty
idn't like the idea of parse_oid_hex as it > stands, so it will end up being mostly moot. In the same email where I made those design suggestions, I also I pointed out a bug in the implementation of parse_oid_hex(). Maybe that is the reason for the test failures. Michael - -- Michael

Re: [PATCH 01/13] delete_ref(): move declaration to refs.h

2015-06-13 Thread Michael Haggerty
On 06/09/2015 06:42 PM, Stefan Beller wrote: > On Tue, Jun 9, 2015 at 3:10 AM, Michael Haggerty wrote: >> In set notation, >> >> "non-NULL" = >> "non-NULL and not NULL_SHA1" ∪ >> "non-NULL and equal to NULL_SHA1"

[PATCH v2 01/12] delete_ref(): move declaration to refs.h

2015-06-13 Thread Michael Haggerty
Also * Add a docstring * Rename the second parameter to "old_sha1", to be consistent with the convention used elsewhere in the refs module Signed-off-by: Michael Haggerty --- cache.h | 2 -- refs.c | 5 +++-- refs.h | 10 ++ 3 files changed, 13 insertions(+), 4

[PATCH v2 04/12] delete_refs(): new function for the refs API

2015-06-13 Thread Michael Haggerty
Move the function remove_branches() from builtin/remote.c to refs.c, rename it to delete_refs(), and make it public. Signed-off-by: Michael Haggerty --- builtin/remote.c | 21 + refs.c | 19 +++ refs.h | 7 +++ 3 files changed, 27

[PATCH v2 03/12] delete_ref(): handle special case more explicitly

2015-06-13 Thread Michael Haggerty
. Signed-off-by: Michael Haggerty --- refs.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index b575bb8..f0b6cec 100644 --- a/refs.c +++ b/refs.c @@ -2795,10 +2795,17 @@ int delete_ref(const char *refname, const unsigned char *old_sha1, struct

[PATCH v2 06/12] prune_remote(): use delete_refs()

2015-06-13 Thread Michael Haggerty
This will result in errors being emitted for references that can't be deleted, but that is a good thing. Signed-off-by: Michael Haggerty --- builtin/remote.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index c8

[PATCH v2 11/12] initial_ref_transaction_commit(): check for ref D/F conflicts

2015-06-13 Thread Michael Haggerty
e shouldn't *be* any existing references when this function is called. But, at least in the case of the "testgit" remote helper, "clone" can be called after the remote-tracking "HEAD" and "master" branches have already been created. So let's just do th

[PATCH v2 12/12] refs: move the remaining ref module declarations to refs.h

2015-06-13 Thread Michael Haggerty
Some functions from the refs module were still declared in cache.h. Move them to refs.h. Add some parameter names where they were missing. Signed-off-by: Michael Haggerty --- archive.c | 1 + builtin/blame.c | 1 + builtin/fast-export.c | 1 + builtin/fmt-merge

[PATCH v2 00/12] Improve "refs" module encapsulation

2015-06-13 Thread Michael Haggerty
error message in delete_refs(). These patches are also available from my GitHub account [2] as branch "init-delete-refs-api". Michael [1] http://thread.gmane.org/gmane.comp.version-control.git/271017 [2] https://github.com/mhagger/git Michael Haggerty (12): delete_ref(): move decl

[PATCH v2 05/12] delete_refs(): improve error message

2015-06-13 Thread Michael Haggerty
convention. Signed-off-by: Michael Haggerty --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 6f62bd1..5386077 100644 --- a/refs.c +++ b/refs.c @@ -2831,7 +2831,7 @@ int delete_refs(struct string_list *refnames) const char *refname

[PATCH v2 02/12] remove_branches(): remove temporary

2015-06-13 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- builtin/remote.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index f4a6ec9..53b8e13 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -756,8 +756,7 @@ static int remove_branches(struct

[PATCH v2 09/12] refs: remove some functions from the module's public interface

2015-06-13 Thread Michael Haggerty
difference between loose and packed references. Signed-off-by: Michael Haggerty --- refs.c | 31 --- refs.h | 30 -- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/refs.c b/refs.c index 05e5d42..a715524 100644 --- a/refs.c

[PATCH v2 10/12] initial_ref_transaction_commit(): check for duplicate refs

2015-06-13 Thread Michael Haggerty
Error out if the ref_transaction includes more than one update for any refname. Signed-off-by: Michael Haggerty --- refs.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/refs.c b/refs.c index a715524..dfe9090 100644 --- a/refs.c +++ b/refs.c @@ -4068,12 +4068,22 @@ int

[PATCH v2 08/12] initial_ref_transaction_commit(): function for initial ref creation

2015-06-13 Thread Michael Haggerty
, the function trusts its caller to only call it when it makes sense. Future commits will add some more limited sanity checks. Signed-off-by: Michael Haggerty --- builtin/clone.c | 19 +++ refs.c | 47 +++ refs.h | 14 +

[PATCH v2 07/12] repack_without_refs(): make function private

2015-06-13 Thread Michael Haggerty
It is no longer called from outside of the refs module. Also move its docstring and change it to imperative voice. Signed-off-by: Michael Haggerty --- refs.c | 9 - refs.h | 11 --- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/refs.c b/refs.c index 5386077

Re: [PATCH v2 05/12] delete_refs(): improve error message

2015-06-19 Thread Michael Haggerty
On 06/15/2015 08:29 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> Subject: Re: [PATCH v2 05/12] delete_refs(): improve error message > > I'd call this "make error message more generic". > >> Change the error message from >> >>

Re: [PATCH v2 12/12] refs: move the remaining ref module declarations to refs.h

2015-06-19 Thread Michael Haggerty
gt;> +extern int for_each_glob_ref_in(each_ref_fn fn, const char *pattern, const >>> char* prefix, void *cb_data); >> >> Likewise for addition of fn and cb_data. >> >> If you really want to make unrelated changes to this file, what you >> should fix is to update "const char* prefix" to "const char *prefix" >> ;-) > > IMHO they are in the same boat (style fixes), and I would be happy to > see both improved. :) I will fix this too. Michael -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in

Re: [PATCH v2 08/12] initial_ref_transaction_commit(): function for initial ref creation

2015-06-19 Thread Michael Haggerty
On 06/15/2015 08:53 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> +struct ref_transaction *t; >> +struct strbuf err = STRBUF_INIT; >> + >> +t = ref_transaction_begin(&err); >> +if (!t) >> +die(err.buf); &g

Re: [PATCH v6 17/19] fsck: Introduce `git fsck --quick`

2015-06-20 Thread Michael Haggerty
lity` check that would would default to OFF but sometimes turn on by hand. -- Michael Haggerty mhag...@alum.mit.edu -- To unsubscribe from this list: send the line "unsubscribe git" in

[PATCH v3 01/19] delete_ref(): move declaration to refs.h

2015-06-22 Thread Michael Haggerty
Also * Add a docstring * Rename the second parameter to "old_sha1", to be consistent with the convention used elsewhere in the refs module Signed-off-by: Michael Haggerty --- cache.h | 2 -- refs.c | 5 +++-- refs.h | 10 ++ 3 files changed, 13 insertions(+), 4

[PATCH v3 11/19] refs: remove some functions from the module's public interface

2015-06-22 Thread Michael Haggerty
difference between loose and packed references. Signed-off-by: Michael Haggerty --- refs.c | 31 --- refs.h | 30 -- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/refs.c b/refs.c index 2367572..31661c7 100644 --- a/refs.c

[PATCH v3 04/19] delete_refs(): new function for the refs API

2015-06-22 Thread Michael Haggerty
Move the function remove_branches() from builtin/remote.c to refs.c, rename it to delete_refs(), and make it public. Signed-off-by: Michael Haggerty --- builtin/remote.c | 21 + refs.c | 19 +++ refs.h | 7 +++ 3 files changed, 27

[PATCH v3 05/19] delete_refs(): make error message more generic

2015-06-22 Thread Michael Haggerty
at it, convert the error message to lower case, as per our usual convention. Signed-off-by: Michael Haggerty --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 6f62bd1..5386077 100644 --- a/refs.c +++ b/refs.c @@ -2831,7 +2831,7 @@ int delet

[PATCH v3 15/19] refs.h: add some parameter names to function declarations

2015-06-22 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs.h | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/refs.h b/refs.h index b22e308..c9596ea 100644 --- a/refs.h +++ b/refs.h @@ -62,7 +62,7 @@ extern int read_ref_full(const char *refname, int resolve_flags

[PATCH v3 14/19] refs: move the remaining ref module declarations to refs.h

2015-06-22 Thread Michael Haggerty
Some functions from the refs module were still declared in cache.h. Move them to refs.h. Signed-off-by: Michael Haggerty --- archive.c | 1 + builtin/blame.c | 1 + builtin/fast-export.c | 1 + builtin/fmt-merge-msg.c | 1 + builtin/init-db.c | 1

[PATCH v3 19/19] delete_ref(): use the usual convention for old_sha1

2015-06-22 Thread Michael Haggerty
d" with the old value set to "does not exist", just as it is for the `--stdin` command "delete". But since this usage was accepted until now, continue to accept it. * The call in delete_branches(), which could pass NULL_SHA1 if deleting a broken or symbolic ref. Change i

[PATCH v3 12/19] initial_ref_transaction_commit(): check for duplicate refs

2015-06-22 Thread Michael Haggerty
Error out if the ref_transaction includes more than one update for any refname. Signed-off-by: Michael Haggerty --- refs.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/refs.c b/refs.c index 31661c7..53d9e45 100644 --- a/refs.c +++ b/refs.c @@ -4087,12 +4087,22 @@ int

[PATCH v3 06/19] delete_refs(): bail early if the packed-refs file cannot be rewritten

2015-06-22 Thread Michael Haggerty
repack_without_refs() fails, emit a more explicit error message and bail. Signed-off-by: Michael Haggerty --- refs.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/refs.c b/refs.c index 5386077..19afc4d 100644 --- a/refs.c +++ b/refs.c @@ -2823,9 +2823,26 @@ int

[PATCH v3 13/19] initial_ref_transaction_commit(): check for ref D/F conflicts

2015-06-22 Thread Michael Haggerty
e shouldn't *be* any existing references when this function is called. But, at least in the case of the "testgit" remote helper, "clone" can be called after the remote-tracking "HEAD" and "master" branches have already been created. So let's just

[PATCH v3 03/19] delete_ref(): handle special case more explicitly

2015-06-22 Thread Michael Haggerty
. Signed-off-by: Michael Haggerty --- refs.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index b575bb8..f0b6cec 100644 --- a/refs.c +++ b/refs.c @@ -2795,10 +2795,17 @@ int delete_ref(const char *refname, const unsigned char *old_sha1, struct

[PATCH v3 00/19] Improve "refs" encapsulation and speed up deletes

2015-06-22 Thread Michael Haggerty
quot;init-delete-refs-api". [1] http://thread.gmane.org/gmane.comp.version-control.git/271017 [2] http://thread.gmane.org/gmane.comp.version-control.git/271552 [3] http://article.gmane.org/gmane.comp.version-control.git/271697 [4] https://github.com/mhagger/git Michael Haggerty (19):

[PATCH v3 16/19] check_branch_commit(): make first parameter const

2015-06-22 Thread Michael Haggerty
Make it clear that this function does not overwrite its first argument. Signed-off-by: Michael Haggerty --- builtin/branch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/branch.c b/builtin/branch.c index b42e5b6..47e3eb9 100644 --- a/builtin/branch.c +++ b/builtin

[PATCH v3 18/19] cmd_update_ref(): make logic more straightforward

2015-06-22 Thread Michael Haggerty
Restructure the code to avoid clearing oldsha1 when oldval is unset. It's value is not needed in that case, so this change makes it more obvious that its initialization is consistent with its later use. Signed-off-by: Michael Haggerty --- builtin/update-ref.c | 13 ++--- 1 file ch

[PATCH v3 08/19] prune_refs(): use delete_refs()

2015-06-22 Thread Michael Haggerty
(admittedly extreme) repositories, we've seen cases where the ref-pruning part of fetch takes multiple tens of minutes. Instead call delete_refs(), which (aside from being less code) has the optimization that it only rewrites the packed-refs file a single time. Signed-off-by: Michael Hag

[PATCH v3 07/19] prune_remote(): use delete_refs()

2015-06-22 Thread Michael Haggerty
because these errors should only ever be seen in the case of a broken repository or a race between two processes; i.e., only in pretty rare and anomalous situations. Signed-off-by: Michael Haggerty --- builtin/remote.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --gi

[PATCH v3 17/19] update_ref(): don't read old reference value before delete

2015-06-22 Thread Michael Haggerty
e previously didn't exist, we can call delete_ref() on it if we don't provide an old_sha1 value. Signed-off-by: Michael Haggerty --- fast-import.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fast-import.c b/fast-import.c index 6378726..d7ed065 100644 ---

[PATCH v3 09/19] repack_without_refs(): make function private

2015-06-22 Thread Michael Haggerty
It is no longer called from outside of the refs module. Also move its docstring and change it to imperative voice. Signed-off-by: Michael Haggerty --- refs.c | 9 - refs.h | 11 --- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/refs.c b/refs.c index 19afc4d

[PATCH v3 10/19] initial_ref_transaction_commit(): function for initial ref creation

2015-06-22 Thread Michael Haggerty
, the function trusts its caller to only call it when it makes sense. Future commits will add some more limited sanity checks. Signed-off-by: Michael Haggerty --- builtin/clone.c | 18 ++ refs.c | 47 +++ refs.h | 14 +

[PATCH v3 02/19] remove_branches(): remove temporary

2015-06-22 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- builtin/remote.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index f4a6ec9..53b8e13 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -756,8 +756,7 @@ static int remove_branches(struct

Re: [PATCH v3 12/19] initial_ref_transaction_commit(): check for duplicate refs

2015-06-23 Thread Michael Haggerty
On 06/22/2015 11:06 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> Error out if the ref_transaction includes more than one update for any >> refname. >> >> Signed-off-by: Michael Haggerty >> --- >> refs.c | 11 +++ >> 1 file c

Re: RFC/Pull Request: Refs db backend

2015-06-23 Thread Michael Haggerty
de since then, > and that there are some further changes in-flight from e.g. Michael > Haggerty. If there is interest in this, I can rebase once Michael's > changes land. It's awesome that you are working on this! I'm reading through your commits and will add comments as th

Re: RFC/Pull Request: Refs db backend

2015-06-23 Thread Michael Haggerty
On 06/23/2015 09:53 PM, David Turner wrote: > On Tue, 2015-06-23 at 17:51 +0200, Michael Haggerty wrote: > [...] >> * I don't like the fact that you have replaced `struct ref_transaction >> *` with `void *` in the public interface. On a practical level, I like >> the

[PATCH] bisect: revise manpage

2015-06-26 Thread Michael Haggerty
Getting help" section down. * Remove the "Look for a fix instead of a regression in the code" example, as (1) it was in the "git bisect run" section, but it doesn't use that command, and (2) I think this usage is adequately explained in the "Alternate terms&

Re: [PATCH] bisect: revise manpage

2015-06-26 Thread Michael Haggerty
On 06/26/2015 02:50 PM, Matthieu Moy wrote: > Michael Haggerty writes: > >> * Remove the "Look for a fix instead of a regression in the code" >> example, as (1) it was in the "git bisect run" section, but it >> doesn't use that command, and (2

Re: [PATCH] bisect: revise manpage

2015-06-26 Thread Michael Haggerty
On 06/26/2015 03:15 PM, Christian Couder wrote: > On Fri, Jun 26, 2015 at 3:00 PM, Matthieu Moy > wrote: >> Christian Couder writes: >> >>> On Fri, Jun 26, 2015 at 1:30 PM, Michael Haggerty >>> wrote: >>> >>> [...] >>> >>&

Re: [PATCH v10.1 7/7] bisect: allow any terms set by user

2015-06-27 Thread Michael Haggerty
ot;: http://article.gmane.org/gmane.comp.version-control.git/244036 I think that making `bisect` smarter could make the UI simpler, though admittedly it would be more work than the current proposal. 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 v10.1 7/7] bisect: allow any terms set by user

2015-06-27 Thread Michael Haggerty
On 06/28/2015 08:15 AM, Junio C Hamano wrote: > On Sat, Jun 27, 2015 at 10:51 PM, Michael Haggerty > wrote: >> >> I would like to remind everybody of my old claim that it would be >> possible to teach `git bisect` to infer by itself which term means >> "

Re: [PATCH v10.1 7/7] bisect: allow any terms set by user

2015-06-28 Thread Michael Haggerty
On 06/28/2015 09:32 AM, Junio C Hamano wrote: > Michael Haggerty writes: > >> I understand that the user might make a mistake when marking the initial >> commits, but as soon as bisect says >> >> Commit is an ancestor of , so I >> will look for the co

[PATCH] fast-import: add a get-mark command

2015-07-01 Thread Michael Haggerty
"get-mark" command to "git fast-import" that allows the importer to ask for the value of a mark that has been created earlier. Signed-off-by: Michael Haggerty --- This is something that we need for an internal GitHub project, but I think it will also be of general interest. Do

[PATCH] Change strbuf_read_file() to return ssize_t

2015-07-03 Thread Michael Haggerty
It is currently declared to return int, which could overflow for large files. Signed-off-by: Michael Haggerty --- This patch is against maint, but it also rebases against master without conflict. I couldn't find any way to exploit this bug. Most callers only use this function for lo

Re: [PATCH v6 1/7] refs.c: add err arguments to reflog functions

2015-07-06 Thread Michael Haggerty
e whatever error message that commit_ref_update() emitted rather than the one that was previously chosen here. > ret = TRANSACTION_GENERIC_ERROR; > goto cleanup; > } else { > diff --git a/refs.h b/refs.h > index e82fca5..debdefc 100644 > --- a/refs.h > +++ b/refs.h > @@ -226,9 +226,9 @@ int pack_refs(unsigned int flags); > #define REF_NODEREF 0x01 > > /* > - * Setup reflog before using. Set errno to something meaningful on failure. > + * Setup reflog before using. Fill in err and return -1 on failure. > */ > -int log_ref_setup(const char *refname, struct strbuf *logfile); > +int log_ref_setup(const char *refname, struct strbuf *logfile, struct strbuf > *err); > > /** Reads log for the value of ref during at_time. **/ > extern int read_ref_at(const char *refname, unsigned int flags, > 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 v6 2/7] cherry-pick: treat CHERRY_PICK_HEAD and REVERT_HEAD as refs

2015-07-06 Thread Michael Haggerty
+ if (ref_transaction_commit(transaction, &err)) > + die(_("Could not commit ref write %s: %s"), ref, err.buf); > } I didn't check all the details, but this code looks a lot like what update_ref() does. Maybe you can use that function? > static void pr

Re: [PATCH v6 5/7] refs: new public ref function: safe_create_reflog

2015-07-06 Thread Michael Haggerty
og_ref_setup(const char *refname, struct strbuf > *sb_logfile, struct strbuf > return 0; > } > > + > +int safe_create_reflog(const char *refname, struct strbuf *err, int > force_create) > +{ > + int ret; > + struct strbuf sb = STRBUF_INIT; > +

Re: [PATCH v6 6/7] git-reflog: add create and exists functions

2015-07-06 Thread Michael Haggerty
; > > + if (!strcmp(argv[1], "create")) > + return cmd_reflog_create(argc - 1, argv + 1, prefix); > + > + if (!strcmp(argv[1], "exists")) > + return cmd_reflog_exists(argc - 1, argv + 1, prefix); > + > return cmd_log_ref

Re: [PATCH v6 1/7] refs.c: add err arguments to reflog functions

2015-07-08 Thread Michael Haggerty
On 07/08/2015 12:41 AM, David Turner wrote: > On Mon, 2015-07-06 at 17:53 +0200, Michael Haggerty wrote: >> On 06/29/2015 10:17 PM, David Turner wrote: >>> [...] >>> @@ -3317,7 +3322,8 @@ static int commit_ref_update(struct ref_lock *lock, >>>

Re: [PATCH v6 5/7] refs: new public ref function: safe_create_reflog

2015-07-08 Thread Michael Haggerty
On 07/08/2015 01:18 AM, David Turner wrote: > On Mon, 2015-07-06 at 18:21 +0200, Michael Haggerty wrote: > > changes applied; will re-roll. > >>> + >>> +int safe_create_reflog(const char *refname, struct strbuf *err, int >>> force_create) >>&

Re: [PATCH v7 1/8] refs.c: add err arguments to reflog functions

2015-07-08 Thread Michael Haggerty
gt; } I see this code already did what I complained about in my earlier email [*]: fail a reference transaction after it is already partly committed. In my opinion this is incorrect for the reasons stated there. But you don't have to consider it to be in the scope of your patch series. [*

Re: [PATCH v7 5/8] refs: new public ref function: safe_create_reflog

2015-07-08 Thread Michael Haggerty
non-zero). Otherwise, create it regardless of the reference * name. Fill in *err and return -1 on failure. */ Otherwise, this patch looks good. 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 v6 6/7] git-reflog: add create and exists functions

2015-07-08 Thread Michael Haggerty
On 07/08/2015 02:49 AM, David Turner wrote: > On Mon, 2015-07-06 at 18:51 +0200, Michael Haggerty wrote: >> [...] >> So all in all, I think it is unwise to allow a reflog to be created >> without its corresponding reference. >> >> This, in turn, suggests one or b

Re: [PATCH v7 7/8] update-ref and tag: add --create-reflog arg

2015-07-08 Thread Michael Haggerty
>* NULL_SHA1 as "don't care" here: > @@ -429,7 +437,12 @@ int cmd_update_ref(int argc, const char **argv, const > char *prefix) > return delete_ref(refname, > (oldval && !is_null_sha1(oldsha1)) ? oldsha1 > : NULL, > flags); > - else > + } else { > + struct strbuf err = STRBUF_INIT; > + if (create_reflog && safe_create_reflog(refname, &err, 1)) > + die("failed to create reflog for %s: %s", refname, > err.buf); This reflog also should not be left around if the reference does not exist at the end of this command. > + > return update_ref(msg, refname, sha1, oldval ? oldsha1 : NULL, > flags, UPDATE_REFS_DIE_ON_ERR); > + } > } > diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh > index d787bf5..9d21c19 100755 > --- a/t/t1400-update-ref.sh > +++ b/t/t1400-update-ref.sh > [...] 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 v7 8/8] git-stash: use update-ref --create-reflog instead of creating files

2015-07-08 Thread Michael Haggerty
27;m happy that we will be getting new commands and command options to deal with reflogs, because that was one case were users previously had to muck about within the .git directory, which is a very bad thing. We need to train users never to look behind the curtain! Michael -- Michael Hag

Re: [PATCH v6 1/7] refs.c: add err arguments to reflog functions

2015-07-08 Thread Michael Haggerty
On 07/08/2015 07:11 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> I think your v7 of this patch goes too far, by turning a failure to >> write to the reflog into a failure of the whole transaction. The problem >> is that this failure comes too late, in

Re: [PATCH v7 2/8] cherry-pick: treat CHERRY_PICK_HEAD and REVERT_HEAD as refs

2015-07-09 Thread Michael Haggerty
n the refs code needs to hold a >> files-backend transaction for HEAD, which it will commit immediately >> after the other transaction succeeds. We can stick a pointer to the >> extra transaction in the generic struct ref_transaction, which (as >> Michael Haggerty suggests) sp

[PATCH 1/6] worktree: consistently use term "linked working tree" in manpages

2015-07-18 Thread Michael Haggerty
Sometimes linked working trees were called "linked working directories" or "linked worktrees". Always refer to them as "linked working trees" for consistency. Signed-off-by: Michael Haggerty --- Documentation/git-worktree.txt | 10 +- Documentation

[PATCH 3/6] worktree: fix incorrect references to file "locked"

2015-07-18 Thread Michael Haggerty
The manpage referred to file "lock" in a couple of places. The file is actually called "locked". Signed-off-by: Michael Haggerty --- Documentation/git-worktree.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-worktree.txt

[PATCH 2/6] worktree: remove references to "git checkout --to" from the manpage

2015-07-18 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- Documentation/git-worktree.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index c8dd0e5..707dfd0 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git

[PATCH 4/6] worktree: the "locked" mechanism is already implemented

2015-07-18 Thread Michael Haggerty
So remove it from the "BUGS" section. Signed-off-by: Michael Haggerty --- Documentation/git-worktree.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index 6cb3877..d5aeda0 100644 --- a/Documentation/git-worktree

[PATCH 6/6] worktree: wordsmith worktree-related manpages

2015-07-18 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- Documentation/config.txt | 8 Documentation/git-worktree.txt | 2 +- Documentation/gitrepository-layout.txt | 18 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Documentation/config.txt b

[PATCH 5/6] config.txt: refer to "git worktree prune", not "prune --worktree"

2015-07-18 Thread Michael Haggerty
The latter doesn't exist. Signed-off-by: Michael Haggerty --- Documentation/config.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 3e37b93..7f65dbb 100644 --- a/Documentation/config.txt +++ b/Document

[PATCH 0/6] Various tweaks to 'worktree'-related manpages

2015-07-18 Thread Michael Haggerty
ncies in the documentation. The last patch contains some wordsmithing. Feel free to squash them together if you prefer. This patch series is also available from my GitHub account [1] as branch "worktree-docs". [1] https://github.com/mhagger/git Michael Haggerty (6): worktree: consis

Re: [PATCH v2 0/5] mh: worktree-related doc fixes

2015-07-20 Thread Michael Haggerty
config manpage. Similarly for the other expiration grace time settings. But it's definitely not a blocker. 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 v8 1/7] refs.c: add err arguments to reflog functions

2015-07-21 Thread Michael Haggerty
error("Trying to write non-commit object %s to branch %s", > - sha1_to_hex(sha1), lock->ref_name); > + strbuf_addf(err, > + "Trying to write non-commit object %s to branch %s", > + sha1_to_hex(sha1), lock->ref_name); > unlock_ref(lock); > errno = EINVAL; > return -1; > [...] 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 v8 4/7] git-reflog: add exists command

2015-07-21 Thread Michael Haggerty
g. "`git reflog delete > master@{2}`"). This subcommand is also typically not used directly by > end users. > > +The "exists" subcommand checks whether a ref has a reflog. It exists The second "exists" should be "exits". > +with zero status i

Re: [PATCH v8 6/7] update-ref and tag: add --create-reflog arg

2015-07-21 Thread Michael Haggerty
t;git tag -d tag_with_reflog" && > + git tag --create-reflog tag_with_reflog && > + git reflog exists refs/tags/tag_with_reflog > +' > + > +test_expect_success '--create-reflog does not creates reflog on failure' ' s/creates

Re: [PATCH v8 0/7] ref backend preamble

2015-07-21 Thread Michael Haggerty
ing to pseudorefs. It just does reflog stuff. > > In addition, this version removes the over-aggressive die() on reflog > update failure from v7. It adds the REF_FORCE_CREATE_REFLOG flag, as > Michael Haggerty suggested. And it fixes commit message or two, as > suggested. I bel

Re: [PATCH v9 1/7] refs.c: add err arguments to reflog functions

2015-07-21 Thread Michael Haggerty
k->orig_ref_name, lock->old_oid.hash, sha1, > logmsg, err) < 0)) { > + char *old_msg = strbuf_detach(err, NULL); > + strbuf_addf(err, "Cannot update the ref '%s': '%s'", > + lock->ref_name, old_msg); The above

Re: [PATCH v9 4/7] git-reflog: add exists command

2015-07-21 Thread Michael Haggerty
y: David Turner > [...] 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

<    1   2   3   4   5   6   7   8   9   10   >