[PATCH 4/5] safe_create_leading_directories(): fix a mkdir/rmdir race

2013-12-21 Thread Michael Haggerty
times before giving up. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/sha1_file.c b/sha1_file.c index dcfd35a..abcb56b 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -108,6 +108,7 @@ int mkdir_in_gitdir(const char

[PATCH 2/5] safe_create_leading_directories(): reduce scope of local variable

2013-12-21 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sha1_file.c b/sha1_file.c index c9245a6..cc9957e 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -108,9 +108,10 @@ int mkdir_in_gitdir(const char *path) int

[PATCH 3/5] safe_create_leading_directories(): add slash pointer

2013-12-21 Thread Michael Haggerty
Keep track of the position of the slash character separately, and restore the slash character at a single place, at the end of the while loop. This makes the next change easier to implement. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 36

[PATCH 5/5] rename_ref(): fix a mkdir()/rmdir() race

2013-12-21 Thread Michael Haggerty
to three attempts before giving up. It could theoretically happen that the ENOENT comes from the disappearance of TMP_RENAMED_LOG. In that case three pointless attempts will be made to move the nonexistent file, but no other harm should come of it. Signed-off-by: Michael Haggerty mhag

[PATCH 0/5] Fix two mkdir/rmdir races

2013-12-21 Thread Michael Haggerty
There seem to be a lot of mkdir/rmdir races in the Git code. Fix two of them. It is hard to construct test cases for races without a lot of extra test infrastructure. So I have tested them as best I can using instrumented code (not included here). Michael Haggerty (5

[PATCH 1/5] safe_create_leading_directories(): modernize format of if chaining

2013-12-21 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sha1_file.c b/sha1_file.c index daacc0c..c9245a6 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -125,8 +125,7 @@ int safe_create_leading_directories(char

Re: [PATCH 2/5] safe_create_leading_directories(): reduce scope of local variable

2014-01-01 Thread Michael Haggerty
On 12/26/2013 10:55 PM, Jonathan Nieder wrote: Michael Haggerty wrote: Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sha1_file.c b/sha1_file.c index c9245a6..cc9957e 100644 --- a/sha1_file.c

Re: [PATCH 3/5] safe_create_leading_directories(): add slash pointer

2014-01-01 Thread Michael Haggerty
On 12/26/2013 11:34 PM, Jonathan Nieder wrote: Michael Haggerty wrote: [Subject: safe_create_leading_directories(): add slash pointer] Is this a cleanup or improving the (internal) functionality of the function somehow? The above one-liner doesn't sum up for me in an obvious way why

Re: [PATCH 4/5] safe_create_leading_directories(): fix a mkdir/rmdir race

2014-01-01 Thread Michael Haggerty
On 12/27/2013 12:02 AM, Jonathan Nieder wrote: Michael Haggerty wrote: It could be that some other process is trying to clean up empty directories at the same time that safe_create_leading_directories() is attempting to create them. In this case, it could happen that directory a/b

[PATCH v2 00/17] Fix some mkdir/rmdir races

2014-01-06 Thread Michael Haggerty
; == I hope to do some more work here in the near future. [1] Version 1: http://thread.gmane.org/gmane.comp.version-control.git/239638 Michael Haggerty (17): safe_create_leading_directories(): fix format of if chaining safe_create_leading_directories

[PATCH v2 01/17] safe_create_leading_directories(): fix format of if chaining

2014-01-06 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sha1_file.c b/sha1_file.c index daacc0c..c9245a6 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -125,8 +125,7 @@ int safe_create_leading_directories(char

[PATCH v2 02/17] safe_create_leading_directories(): reduce scope of local variable

2014-01-06 Thread Michael Haggerty
This makes it more obvious that values of st don't persist across loop iterations. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sha1_file.c b/sha1_file.c index c9245a6..cc9957e 100644 --- a/sha1_file.c

[PATCH v2 09/17] safe_create_leading_directories(): add new error value SCLD_VANISHED

2014-01-06 Thread Michael Haggerty
something in it. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h | 10 +- sha1_file.c | 11 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cache.h b/cache.h index c6a4157..f34c0a7 100644 --- a/cache.h +++ b/cache.h @@ -741,12 +741,20 @@ int

[PATCH v2 16/17] rename_tmp_log(): limit the number of remote_empty_directories() attempts

2014-01-06 Thread Michael Haggerty
This doesn't seem to be a likely error, but we've got the counter anyway, so we might as well use it for an added bit of safety. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index 8de636e

[PATCH v2 13/17] remove_dir_recurse(): handle disappearing files and directories

2014-01-06 Thread Michael Haggerty
If a file or directory that we are trying to remove disappears (e.g., because another process has pruned it), do not consider it an error. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- dir.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git

[PATCH v2 12/17] remove_dir_recurse(): tighten condition for removing unreadable dir

2014-01-06 Thread Michael Haggerty
If opendir() fails on the top-level directory, it makes sense to try to delete it anyway--but only if the failure was due to EACCES. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- dir.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dir.c b/dir.c index

[PATCH v2 11/17] lock_ref_sha1_basic(): if locking fails with ENOENT, retry

2014-01-06 Thread Michael Haggerty
If hold_lock_file_for_update() fails with errno==ENOENT, it might be because somebody else (for example, a pack-refs process) has just deleted one of the lockfile's ancestor directories. So if this condition is detected, try again (up to 3 times). Signed-off-by: Michael Haggerty mhag

[PATCH v2 17/17] rename_tmp_log(): on SCLD_VANISHED, retry

2014-01-06 Thread Michael Haggerty
If safe_create_leading_directories() fails because a file along the path unexpectedly vanished, try again from the beginning. Try at most 3 times. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/refs.c b

[PATCH v2 04/17] safe_create_leading_directories(): rename local variable

2014-01-06 Thread Michael Haggerty
Rename pos to next_component, because now it always points at the next component of the path name that has to be processed. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sha1_file.c b

[PATCH v2 06/17] safe_create_leading_directories(): always restore slash at end of loop

2014-01-06 Thread Michael Haggerty
Always restore the slash that we scribbled over at the end of the loop, rather than also fixing it up at each premature exit from the loop. This makes it harder to forget to do the cleanup as new paths are added to the code. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c

Re: [PATCH v2 03/17] safe_create_leading_directories(): add explicit slash pointer

2014-01-07 Thread Michael Haggerty
On 01/06/2014 07:32 PM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: Keep track of the position of the slash character independently of pos, thereby making the purpose of each variable clearer and working towards other upcoming changes. Signed-off-by: Michael

Re: [PATCH v2 13/17] remove_dir_recurse(): handle disappearing files and directories

2014-01-07 Thread Michael Haggerty
On 01/06/2014 07:18 PM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: If a file or directory that we are trying to remove disappears (e.g., because another process has pruned it), do not consider it an error. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu

Re: [PATCH v2 10/17] lock_ref_sha1_basic(): on SCLD_VANISHED, retry

2014-01-07 Thread Michael Haggerty
On 01/06/2014 06:54 PM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: If safe_create_leading_directories() fails because a file along the path unexpectedly vanished, try again (up to 3 times). This can occur if another process is deleting directories at the same time

Re: [PATCH v2 17/17] rename_tmp_log(): on SCLD_VANISHED, retry

2014-01-07 Thread Michael Haggerty
On 01/06/2014 07:21 PM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: If safe_create_leading_directories() fails because a file along the path unexpectedly vanished, try again from the beginning. Try at most 3 times. As the previous step bumped it from 3 to 4

Re: [PATCH v3 3/5] refs: teach for_each_ref a flag to avoid recursion

2014-01-08 Thread Michael Haggerty
up is_refname_available(), but it would be a little bit of work and I doubt that is_refname_available() is ever a bottleneck. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message

[PATCH 1/3] shorten_unambiguous_ref(): introduce a new local variable

2014-01-08 Thread Michael Haggerty
When filling the scanf_fmts array, use a separate variable to keep track of the offset to avoid clobbering total_len (which we will need in the next commit). Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH 3/3] shorten_unambiguous_ref(): tighten up pointer arithmetic

2014-01-08 Thread Michael Haggerty
As long as we're being pathologically stingy with mallocs, we might as well do the math right and save 6 (!) bytes. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- It is left to the reader to show how another 7 bytes could be saved (11 bytes on a 64-bit architecture!) It probably

[PATCH 0/3] Generate scanf_fmts more simply

2014-01-08 Thread Michael Haggerty
This is just a fun little thing that I noticed while poking around the code: the function gen_scanf_fmt() can be replaced with a simple call to snprintf(). Michael Haggerty (3): shorten_unambiguous_ref(): introduce a new local variable gen_scanf_fmt(): delete function and use snprintf

[PATCH 2/3] gen_scanf_fmt(): delete function and use snprintf() instead

2014-01-08 Thread Michael Haggerty
To replace %.*s with %s, all we have to do is use snprintf() to interpolate %s into the pattern. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 35 +-- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/refs.c b/refs.c index 9530480

Re: [PATCH v2 4/5] get_sha1: speed up ambiguous 40-hex test

2014-01-08 Thread Michael Haggerty
)); } - free(real_ref); } return 0; } Despite all my bellyaching, I think that your optimizing of these lookups gives a nice speedup and I think that the approach that you took is also OK. Michael -- Michael Haggerty mhag...@alum.mit.edu

Re: [PATCH v2 5/5] get_sha1: drop object/refname ambiguity flag

2014-01-08 Thread Michael Haggerty
(better actually, but that is within the noise). Signed-off-by: Jeff King p...@peff.net [...] Very nice. Correctness without a performance hit. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git

Re: [PATCH v3 3/5] refs: teach for_each_ref a flag to avoid recursion

2014-01-10 Thread Michael Haggerty
On 01/09/2014 10:49 PM, Jeff King wrote: On Wed, Jan 08, 2014 at 12:29:51PM +0100, Michael Haggerty wrote: Here's a fixed version of patch 3/5. v2 4/5 doesn't apply cleanly on top of v3 3/5. So I'm basing my review on the branch you have at GitHub peff/git jk/cat-file-warn-ambiguous; I

Re: [PATCH 3/3] shorten_unambiguous_ref(): tighten up pointer arithmetic

2014-01-10 Thread Michael Haggerty
On 01/10/2014 12:01 AM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: As long as we're being pathologically stingy with mallocs, we might as well do the math right and save 6 (!) bytes. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- It is left to the reader

[PATCH] gitattributes: document more clearly where macros are allowed

2014-01-13 Thread Michael Haggerty
The old text made it sound like macros are only allowed in the .gitattributes file at the top-level of the working tree. Make it clear that they are also allowed in $GIT_DIR/info/attributes and in the global and system-wide gitattributes files. Signed-off-by: Michael Haggerty mhag

[PATCH] refname_match(): always use the rules in ref_rev_parse_rules

2014-01-13 Thread Michael Haggerty
. Suggested-by: Junio C Hamano gits...@pobox.com Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- See http://article.gmane.org/gmane.comp.version-control.git/240305 in which Junio made the suggestion and wrote most of the commit message :-) cache.h | 9 ++--- refs.c | 6

Re: [PATCH v2 4/5] get_sha1: speed up ambiguous 40-hex test

2014-01-14 Thread Michael Haggerty
--hashes-only option that tells cat-file to treat all of its arguments/inputs as SHA-1s; such an option would permit an even faster code path for bulk callers. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe

Re: [PATCH] refname_match(): always use the rules in ref_rev_parse_rules

2014-01-15 Thread Michael Haggerty
On 01/14/2014 11:16 PM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: We used to use two separate rules for the normal ref resolution dwimming and dwimming done to decide which remote ref to grab. The third parameter to refname_match() selected which rules to use

Re: git log --no-walk --tags produces strange result for certain user

2014-01-16 Thread Michael Haggerty
points at a tag object 8f6ca98087 which itself points at another tag object 2eddbcbff4 which finally points at commit 8b4043428b. Probably we should handle recursive tag objects like this, but OTOH I can't think of a reason why one would want to create them in the first place. Michael -- Michael

Re: git log --no-walk --tags produces strange result for certain user

2014-01-17 Thread Michael Haggerty
On 01/16/2014 11:31 AM, Michael Haggerty wrote: On 12/16/2013 12:52 PM, Kirill Likhodedov wrote: I received one more complaint for this issue, and now it appears in a public repository https://github.com/spray/spray To reproduce: # git clone https://github.com/spray/spray # cd spray

[PATCH v3 15/17] rename_tmp_log(): handle a possible mkdir/rmdir race

2014-01-18 Thread Michael Haggerty
that directory, one of the two is doomed to failure anyway because of a D/F conflict. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index d0fab39..a90904b 100644 --- a/refs.c +++ b/refs.c

[PATCH v3 11/17] lock_ref_sha1_basic(): if locking fails with ENOENT, retry

2014-01-18 Thread Michael Haggerty
If hold_lock_file_for_update() fails with errno==ENOENT, it might be because somebody else (for example, a pack-refs process) has just deleted one of the lockfile's ancestor directories. So if this condition is detected, try again (up to 3 times). Signed-off-by: Michael Haggerty mhag

[PATCH v3 01/17] safe_create_leading_directories(): fix format of if chaining

2014-01-18 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sha1_file.c b/sha1_file.c index e13bd2c..8031d51 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -125,8 +125,7 @@ int safe_create_leading_directories(char

[PATCH v3 04/17] safe_create_leading_directories(): rename local variable

2014-01-18 Thread Michael Haggerty
Rename pos to next_component, because now it always points at the next component of the path name that has to be processed. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sha1_file.c b

[PATCH v3 10/17] lock_ref_sha1_basic(): on SCLD_VANISHED, retry

2014-01-18 Thread Michael Haggerty
-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 490b57b..9ae184d 100644 --- a/refs.c +++ b/refs.c @@ -2039,6 +2039,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname

[PATCH v3 07/17] safe_create_leading_directories(): introduce enum for return values

2014-01-18 Thread Michael Haggerty
Instead of returning magic integer values (which a couple of callers go to the trouble of distinguishing), return values from an enum. Add a docstring. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/init-db.c | 4 ++-- cache.h | 17 +++-- merge

[PATCH v3 06/17] safe_create_leading_directories(): always restore slash at end of loop

2014-01-18 Thread Michael Haggerty
Always restore the slash that we scribbled over at the end of the loop, rather than also fixing it up at each premature exit from the loop. This makes it harder to forget to do the cleanup as new paths are added to the code. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c

[PATCH v3 02/17] safe_create_leading_directories(): reduce scope of local variable

2014-01-18 Thread Michael Haggerty
This makes it more obvious that values of st don't persist across loop iterations. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sha1_file.c b/sha1_file.c index 8031d51..d8647c7 100644 --- a/sha1_file.c

[PATCH v3 14/17] rename_ref(): extract function rename_tmp_log()

2014-01-18 Thread Michael Haggerty
It's about to become a bit more complex. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 52 ++-- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/refs.c b/refs.c index 4060ed1..d0fab39 100644 --- a/refs.c +++ b

[PATCH v3 17/17] rename_tmp_log(): on SCLD_VANISHED, retry

2014-01-18 Thread Michael Haggerty
If safe_create_leading_directories() fails because a file along the path unexpectedly vanished, try again from the beginning. Try at most 4 times. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/refs.c b

[PATCH v3 00/17] Fix some mkdir/rmdir races

2014-01-18 Thread Michael Haggerty
commit messages. Michael Haggerty (17): safe_create_leading_directories(): fix format of if chaining safe_create_leading_directories(): reduce scope of local variable safe_create_leading_directories(): add explicit slash pointer safe_create_leading_directories(): rename local variable

[PATCH v3 03/17] safe_create_leading_directories(): add explicit slash pointer

2014-01-18 Thread Michael Haggerty
Keep track of the position of the slash character independently of pos, thereby making the purpose of each variable clearer and working towards other upcoming changes. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c | 20 +++- 1 file changed, 11 insertions

[PATCH v3 05/17] safe_create_leading_directories(): split on first of multiple slashes

2014-01-18 Thread Michael Haggerty
() is called on foo/, it fails with ENOTDIR if foo exists but is not a directory. This caused the wrong path to be taken in the subsequent logic. So instead, split path components at the first intercomponent slash rather than the last one. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu

[PATCH v3 13/17] remove_dir_recurse(): handle disappearing files and directories

2014-01-18 Thread Michael Haggerty
If a file or directory that we are trying to remove disappears (e.g., because another process has pruned it), do not consider it an error. However, if REMOVE_DIR_KEEP_TOPLEVEL is set, and the toplevel directory is missing, then consider it an error (like before). Signed-off-by: Michael Haggerty

[PATCH v3 08/17] cmd_init_db(): when creating directories, handle errors conservatively

2014-01-18 Thread Michael Haggerty
other nonzero values as failures. This is more robust in case somebody adds another possible return value without telling us. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/init-db.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin/init-db.c b

[PATCH v3 12/17] remove_dir_recurse(): tighten condition for removing unreadable dir

2014-01-18 Thread Michael Haggerty
If opendir() fails on the top-level directory, it makes sense to try to delete it anyway--but only if the failure was due to EACCES. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- dir.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dir.c b/dir.c index

[PATCH v3 16/17] rename_tmp_log(): limit the number of remote_empty_directories() attempts

2014-01-18 Thread Michael Haggerty
attempts to 4, to be sure that we can still have at least 3 retries in the case of a race. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- refs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index a90904b..134d5aa 100644 --- a/refs.c +++ b/refs.c

[PATCH v3 09/17] safe_create_leading_directories(): add new error value SCLD_VANISHED

2014-01-18 Thread Michael Haggerty
something in it. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h | 10 +- sha1_file.c | 11 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cache.h b/cache.h index 8030e36..c0a7a8a 100644 --- a/cache.h +++ b/cache.h @@ -742,12 +742,20 @@ int

[PATCH v2] safe_create_leading_directories(): on Windows, \ can separate path components

2014-01-18 Thread Michael Haggerty
-by: Michael Haggerty mhag...@alum.mit.edu --- This patch applies on top of v3 of mh/safe-create-leading-directories. The only logical change from Sebastian's patch is that this version restores the original slash character rather than always restoring it to '/' (as suggested by Junio). Please note that I

Re: Verifiable git archives?

2014-01-18 Thread Michael Haggerty
were excluded from the archive using gitattribute export-ignore (or export-subst, which you already mentioned in a follow-up email). Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body

Anomalous AUTHOR and DOCUMENTATION sections in manpages

2014-01-22 Thread Michael Haggerty
-- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- 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

[PATCH] Add cross-references between docs for for-each-ref and show-ref

2014-01-22 Thread Michael Haggerty
Add cross-references between the manpages for git-for-each-ref(1) and git-show-ref(1). Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- There is a lot of overlap between the functionality of these two commands. It might be handy to give the user some hints about when to use one command

Re: Anomalous AUTHOR and DOCUMENTATION sections in manpages

2014-01-22 Thread Michael Haggerty
On 01/22/2014 12:22 PM, Michael Haggerty wrote: I just noticed that there are exactly four Git manpages with an AUTHOR section and five with a DOCUMENTATION section: $ make doc $ grep -nIE -e '^\.SH DOCUMENTATION|AUTHOR' Documentation/*.[0-9] Documentation/git-column.1:80:.SH

[PATCH] doc: remote author/documentation sections from more pages

2014-01-26 Thread Michael Haggerty
We decided at 48bb914e (doc: drop author/documentation sections from most pages, 2011-03-11) to remove author and documentation sections from our documentation. Remove a few stragglers. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- These deletions were assented to on the Git mailing

Re: [PATCH] doc: remote author/documentation sections from more pages

2014-01-26 Thread Michael Haggerty
On 01/27/2014 01:15 AM, Eric Sunshine wrote: On Sun, Jan 26, 2014 at 6:43 PM, Michael Haggerty mhag...@alum.mit.edu wrote: Subject: [PATCH] doc: remote author/documentation sections from more pages s/remote/remove/ Gaah! Git is a virus that invades your muscle memory and prevents you from

[PATCH 2/3] diff_scoreopt_parse(): use skip_prefix_if_present()

2014-02-04 Thread Michael Haggerty
Whenever skip_prefix_defval() was called, opt was still equal to *opt_p. So we can use skip_prefix_if_present() instead. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- diff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index d629cc5

[PATCH 3/3] rev_is_head(): use skip_prefix()

2014-02-04 Thread Michael Haggerty
Change the logic a little bit so that we can use skip_prefix() instead of doing pointer arithmetic with hardcoded numbers. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin/show-branch.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/builtin/show

[PATCH 0/3] Add a function skip_prefix_if_present()

2014-02-04 Thread Michael Haggerty
These patches apply on top of gitster/nd/more-skip-prefix. I noticed that Duy's new function skip_prefix_defval() was mostly being called with its first and third arguments the same. So introduce a function skip_prefix_if_present() that implements this pattern. Michael Haggerty (3): Add

[PATCH 1/3] Add and use a function skip_prefix_if_present()

2014-02-04 Thread Michael Haggerty
Most of the calls to skip_prefix_defval() had equal first and third arguments, with the effect of skipping the prefix if present, but otherwise returning the original string. So define a new function that does exactly that. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- builtin

Re: [PATCH 0/3] Add a function skip_prefix_if_present()

2014-02-04 Thread Michael Haggerty
On 02/05/2014 07:25 AM, Michael Haggerty wrote: These patches apply on top of gitster/nd/more-skip-prefix. I noticed that Duy's new function skip_prefix_defval() was mostly being called with its first and third arguments the same. So introduce a function skip_prefix_if_present

Re: [PATCH] tree-walk: be more specific about corrupt tree errors

2014-02-13 Thread Michael Haggerty
. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- 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 2/2] check-attr: move to the top of working tree when in non-bare repository

2014-02-16 Thread Michael Haggerty
be nice for git check-attr to handle this case. Currently, I believe that one has to resort to a temporary index file via something like ( export GIT_INDEX_FILE=$(mktemp) git read-tree HEAD git check-attr --cached ... rm $GIT_INDEX_FILE ) Michael -- Michael

[PATCH] Rename read_replace_refs to check_replace_refs

2014-02-18 Thread Michael Haggerty
The semantics of this flag was changed in commit ecef23 inline lookup_replace_object() calls but wasn't renamed at the time to minimize code churn. Rename it now, and add a comment explaining its use. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- This change doesn't conflict

Re: error: src refspec refs/heads/master matches more than one.

2014-02-19 Thread Michael Haggerty
. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- 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: release-notes could be clearer on git-fetch changes

2014-02-20 Thread Michael Haggerty
. One thing I personally don't like is that git push $remote --all --tags is not allowed. I would expect it to push all branches and all tags. But at least it just emits an error rather than doing something unexpected. Michael -- Michael Haggerty mhag...@alum.mit.edu http

[PATCH 1/6] Add docstrings for lookup_replace_object() and do_lookup_replace_object()

2014-02-21 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h | 16 1 file changed, 16 insertions(+) diff --git a/cache.h b/cache.h index dc040fb..0ecd1c8 100644 --- a/cache.h +++ b/cache.h @@ -788,13 +788,29 @@ static inline void *read_sha1_file(const unsigned char *sha1

[PATCH 2/6] replace_object: use struct members instead of an array

2014-02-21 Thread Michael Haggerty
Give the poor humans some names to help them make sense of things. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- replace_object.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/replace_object.c b/replace_object.c index cdcaf8c..6fc3ff4 100644

[PATCH 3/6] find_pack_entry(): document last_found_pack

2014-02-21 Thread Michael Haggerty
Add a comment at the declaration of last_found_pack and where it is used in find_pack_entry(). In the latter, separate the cases (1) to make a place for the new comment and (2) to turn the success case into affirmative logic. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- sha1_file.c

[PATCH 0/6] Add a bunch of docstrings and make a few minor cleanups

2014-02-21 Thread Michael Haggerty
also fixed up a couple of small things that I noticed along the way: refactoring for understanding. Michael Haggerty (6): Add docstrings for lookup_replace_object() and do_lookup_replace_object() replace_object: use struct members instead of an array find_pack_entry(): document

[PATCH 4/6] sha1_file_name(): declare to return a const string

2014-02-21 Thread Michael Haggerty
Change the return value of sha1_file_name() to (const char *). (Callers have no business mucking about here.) Change callers accordingly, deleting a few superfluous temporary variables along the way. Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h | 2 +- http.c | 2

[PATCH 6/6] Document some functions defined in object.c

2014-02-21 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- object.c | 23 ++- object.h | 7 +++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/object.c b/object.c index 584f7ac..c34e225 100644 --- a/object.c +++ b/object.c @@ -43,14 +43,26 @@ int

[PATCH 5/6] Document a bunch of functions defined in sha1_file.c

2014-02-21 Thread Michael Haggerty
Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h | 66 ++--- sha1_file.c | 26 +--- 2 files changed, 78 insertions(+), 14 deletions(-) diff --git a/cache.h b/cache.h index 1663478..e62fdec 100644

Re: [PATCH 1/6] Add docstrings for lookup_replace_object() and do_lookup_replace_object()

2014-02-24 Thread Michael Haggerty
On 02/21/2014 07:21 PM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h | 16 1 file changed, 16 insertions(+) diff --git a/cache.h b/cache.h index dc040fb..0ecd1c8 100644

Re: [PATCH 6/6] Document some functions defined in object.c

2014-02-24 Thread Michael Haggerty
Nicolas, thanks for the very fast feedback! On 02/21/2014 06:33 PM, Nicolas Pitre wrote: On Fri, 21 Feb 2014, Michael Haggerty wrote: Signed-off-by: Michael Haggerty mhag...@alum.mit.edu Minor nits below. --- object.c | 23 ++- object.h | 7 +++ 2 files

Re: [PATCH 1/6] Add docstrings for lookup_replace_object() and do_lookup_replace_object()

2014-02-24 Thread Michael Haggerty
On 02/24/2014 10:24 AM, Christian Couder wrote: On Fri, Feb 21, 2014 at 5:32 PM, Michael Haggerty mhag...@alum.mit.edu wrote: Signed-off-by: Michael Haggerty mhag...@alum.mit.edu --- cache.h | 16 1 file changed, 16 insertions(+) diff --git a/cache.h b/cache.h index

Re: [PATCH 5/6] Document a bunch of functions defined in sha1_file.c

2014-02-24 Thread Michael Haggerty
On 02/24/2014 07:18 PM, Jakub Narębski wrote: Michael Haggerty wrote: -/* - * NOTE! This returns a statically allocated buffer, so you have to be - * careful about using it. Do an xstrdup() if you need to save the - * filename. - * - * Also note that this returns the location for creating

Re: [PATCH 5/6] Document a bunch of functions defined in sha1_file.c

2014-02-25 Thread Michael Haggerty
On 02/24/2014 09:08 PM, Jonathan Nieder wrote: Michael Haggerty wrote: [...] I've been documenting public functions in the header files above the declaration, and private ones where they are defined. [...] Let me know if you think I've made it less helpful. In the present state

Re: Git in GSoC 2014

2014-02-25 Thread Michael Haggerty
you think? Michael [1] https://github.com/git/git.github.io -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- 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

GSoC idea: allow git rebase --interactive todo lines to take options

2014-02-26 Thread Michael Haggerty
comments and cleaning up the script as you go would be very welcome. - Language: sh - Difficulty: medium - Possible mentors: Michael Haggerty -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body

Re: Git in GSoC 2014

2014-02-26 Thread Michael Haggerty
On 02/26/2014 11:23 AM, Jeff King wrote: On Tue, Feb 25, 2014 at 06:15:28PM +0100, Michael Haggerty wrote: Requiring students to submit a reasonable patch and follow up on review comments seems like it would be a good way to filter out non-serious students. (I hesitate to require

Re: GSoC idea: allow git rebase --interactive todo lines to take options

2014-02-26 Thread Michael Haggerty
On 02/26/2014 11:52 AM, Jeff King wrote: On Wed, Feb 26, 2014 at 09:04:30AM +0100, Michael Haggerty wrote: It would be nice to support more flexibility in the todo-list commands by allowing the commands to take options. Maybe * Convert a commit into a merge commit: pick -p c0ffeee

Re: Git in GSoC 2014

2014-02-26 Thread Michael Haggerty
On 02/26/2014 08:48 PM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: See my branch on GitHub [1] or read the appended text below. Very nice. ## Introduction It is strongly recommended that students who want to apply to the Git project for the Summer of Code 2014

Re: GSoC idea: allow git rebase --interactive todo lines to take options

2014-02-26 Thread Michael Haggerty
On 02/26/2014 11:52 AM, Jeff King wrote: On Wed, Feb 26, 2014 at 09:04:30AM +0100, Michael Haggerty wrote: It would be nice to support more flexibility in the todo-list commands by allowing the commands to take options. Maybe * Convert a commit into a merge commit: pick -p c0ffeee

Re: [PATCH 2/2] fetch: handle overlaping refspecs on --prune

2014-02-27 Thread Michael Haggerty
to string_list_clear(matches) on a couple of code paths. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- 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

Re: An idea for git bisect and a GSoC enquiry

2014-02-27 Thread Michael Haggerty
unimplemented for a lamentably long time, my personal feeling is that it has too meat in it to constitute a GSoC project by itself. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message

Re: [PATCH] GSoC 2014 Microproject 1 rewrite skip_prefix() as loop

2014-02-27 Thread Michael Haggerty
below). + else if (*str != *prefix) + return NULL; } #if defined(NO_MMAP) || defined(USE_WIN32_MMAP) The code itself looks correct. But, considering your comment, would it be appropriate for one of the functions to call the other? Michael -- Michael

Re: [PATCH] branch: change install_branch_config() to use skip_prefix()

2014-02-27 Thread Michael Haggerty
, refs_heads_prefix); struct strbuf key = STRBUF_INIT; int rebasing = should_setup_rebase(origin); If you look at what skip_prefix() and starts_with() do, I think you will find that you are doing too much work here. Michael -- Michael Haggerty mhag...@alum.mit.edu http

Re: Git in GSoC 2014

2014-02-27 Thread Michael Haggerty
On 02/27/2014 08:19 PM, Junio C Hamano wrote: Michael Haggerty mhag...@alum.mit.edu writes: Sounds good. I suggest we make your blob a paragraph before the list of bullet points rather than part of the list. Please suggest some TBD* then I'll add it to the text. Would we also fill in X

Re: Branch Name Case Sensitivity

2014-02-27 Thread Michael Haggerty
not notice any difference. With ten thousand you probably would. Somewhere in between lies the pain threshold. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord

Students: Please only do one microproject!

2014-02-27 Thread Michael Haggerty
report on the mailing list. etc. etc. In other words, do things that other people on the mailing list do. Thanks! Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message

Re: [PATCH] GSoC2014 microprojects Rewrite bulk-checkin.c:finish_bulk_checkin() to use a strbuf for handling packname

2014-02-27 Thread Michael Haggerty
mail arrived at the list. You can check the mailing list archives at gmane.org to verify things like this. Michael -- Michael Haggerty mhag...@alum.mit.edu http://softwareswirl.blogspot.com/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord

  1   2   3   4   5   6   7   8   9   10   >