[ANNOUNCE] git-test: run automated tests against a range of Git commits

2017-01-06 Thread Michael Haggerty
. I don't plan to turn this into a gigantic project or anything, but I find this script really useful so I wanted to put it out in the world. Feedback and/or pull requests welcome! Michael [1] The name sucks, I know :-/ [2] https://github.com/mhagger/git-test/blob/master/README.md

[PATCH v4 00/23] Delete directories left empty after ref deletion

2017-01-06 Thread Michael Haggerty
27;t accommodate consecutive slashes", for reasons discussed on the ML [4]. Michael [1] http://public-inbox.org/git/cover.1455626201.git.mhag...@alum.mit.edu/T/#u [2] http://public-inbox.org/git/cover.1456405698.git.mhag...@alum.mit.edu/T/#u [3] http://public-inbox.org/git/cover.14831534

[PATCH v4 09/23] rename_tmp_log(): use raceproof_create_file()

2017-01-06 Thread Michael Haggerty
Besides shortening the code, this saves an unnecessary call to safe_create_leading_directories_const() in almost all cases. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 73 +--- 1 file changed, 30 insertions(+), 43 deletions(-) diff

[PATCH v4 05/23] safe_create_leading_directories(): set errno on SCLD_EXISTS

2017-01-06 Thread Michael Haggerty
The exit path for SCLD_EXISTS wasn't setting errno, which some callers use to generate error messages for the user. Fix the problem and document that the function sets errno correctly to help avoid similar regressions in the future. Signed-off-by: Michael Haggerty --- cache.h

[PATCH v4 22/23] try_remove_empty_parents(): teach to remove parents of reflogs, too

2017-01-06 Thread Michael Haggerty
Add a new "flags" parameter that tells the function whether to remove empty parent directories of the loose reference file, of the reflog file, or both. The new functionality is not yet used. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 24 ++-- 1 fi

[PATCH v4 23/23] files_transaction_commit(): clean up empty directories

2017-01-06 Thread Michael Haggerty
ation* of these directories could race with our deletion of them. But the earlier changes in this patch series made the creation paths robust against races, so now it is safe to tidy them up more aggressively. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 34 --

[PATCH v4 19/23] delete_ref_loose(): inline function

2017-01-06 Thread Michael Haggerty
It was hardly doing anything anymore, and had only one caller. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 25 +++-- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 4d55364..9abd7c3 100644 --- a

[PATCH v4 14/23] log_ref_setup(): pass the open file descriptor back to the caller

2017-01-06 Thread Michael Haggerty
-by: Michael Haggerty --- refs/files-backend.c | 39 ++- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 27d4fd3..f723834 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2719,19

[PATCH v4 08/23] lock_ref_sha1_basic(): use raceproof_create_file()

2017-01-06 Thread Michael Haggerty
Instead of coding the retry loop inline, use raceproof_create_file() to make lock acquisition safe against directory creation/deletion races. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 35 +-- 1 file changed, 9 insertions(+), 26 deletions(-) diff

[PATCH v4 07/23] lock_ref_sha1_basic(): inline constant

2017-01-06 Thread Michael Haggerty
`lflags` is set a single time then never changed, so just inline it. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index be4ffdc..7d4658a 100644 --- a/refs/files

[PATCH v4 03/23] t5505: use "for-each-ref" to test for the non-existence of references

2017-01-06 Thread Michael Haggerty
Instead of looking on the filesystem inside ".git/refs/remotes/origin", use "git for-each-ref" to check for leftover references under the remote's old name. Signed-off-by: Michael Haggerty --- t/t5505-remote.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v4 12/23] log_ref_setup(): separate code for create vs non-create

2017-01-06 Thread Michael Haggerty
The behavior of this function (especially how it handles errors) is quite different depending on whether we are willing to create the reflog vs. whether we are only trying to open an existing reflog. So separate the code paths. This also simplifies the next steps. Signed-off-by: Michael Haggerty

[PATCH v4 13/23] log_ref_setup(): improve robustness against races

2017-01-06 Thread Michael Haggerty
was previously done unconditionally. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 41 ++--- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index c8f6d82..27d4fd3 100644 --- a/refs/files

[PATCH v4 18/23] delete_ref_loose(): derive loose reference path from lock

2017-01-06 Thread Michael Haggerty
It is simpler to derive the path to the file that must be deleted from "lock->ref_name" than from the lock_file object. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/refs/files-backend.c b/refs/fi

[PATCH v4 10/23] rename_tmp_log(): improve error reporting

2017-01-06 Thread Michael Haggerty
* Don't capitalize error strings * Report true paths of affected files Signed-off-by: Michael Haggerty --- refs/files-backend.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 3f18a01..49a119c 100644 --- a/refs/

[PATCH v4 01/23] files_rename_ref(): tidy up whitespace

2017-01-06 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 f902393..be4ffdc 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2631,7 +2631,7 @@ static int

[PATCH v4 04/23] safe_create_leading_directories_const(): preserve errno

2017-01-06 Thread Michael Haggerty
Some implementations of free() change errno (even thought they shouldn't): https://sourceware.org/bugzilla/show_bug.cgi?id=17924 So preserve the errno from safe_create_leading_directories() across the call to free(). Signed-off-by: Michael Haggerty --- sha1_file.c | 4 1 file ch

[PATCH v4 16/23] log_ref_setup(): manage the name of the reflog file internally

2017-01-06 Thread Michael Haggerty
eters before the output parameters. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 69 ++-- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 9c5e804..846380f 100644 --- a

[PATCH v4 21/23] try_remove_empty_parents(): don't trash argument contents

2017-01-06 Thread Michael Haggerty
It's bad manners and surprising and therefore error-prone. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 92a9d99..88f8c7a 100644 --- a/refs/

[PATCH v4 20/23] try_remove_empty_parents(): rename parameter "name" -> "refname"

2017-01-06 Thread Michael Haggerty
This is the standard nomenclature. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 9abd7c3..92a9d99 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c

[PATCH v4 11/23] log_ref_write(): inline function

2017-01-06 Thread Michael Haggerty
This function doesn't do anything beyond call files_log_ref_write(), so replace it with the latter at its call sites. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/refs/files-backen

[PATCH v4 02/23] refname_is_safe(): correct docstring

2017-01-06 Thread Michael Haggerty
ormalizing the part of a refname following "refs/" is identical to that part of the original refname. Fix the docstring. Signed-off-by: Michael Haggerty --- refs/refs-internal.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/refs/refs-internal.h b/refs/r

[PATCH v4 06/23] raceproof_create_file(): new function

2017-01-06 Thread Michael Haggerty
yet used. Signed-off-by: Michael Haggerty --- cache.h | 43 ++ sha1_file.c | 68 + 2 files changed, 111 insertions(+) diff --git a/cache.h b/cache.h index 8177c3a..95cde14 100644 --- a/cache.h

[PATCH v4 17/23] log_ref_write_1(): inline function

2017-01-06 Thread Michael Haggerty
Now files_log_ref_write() doesn't do anything beyond call log_ref_write_1(), so inline the latter into the former. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs/

[PATCH v4 15/23] log_ref_write_1(): don't depend on logfile argument

2017-01-06 Thread Michael Haggerty
It's unnecessary to pass a strbuf holding the reflog path up and down the call stack now that it is hardly needed by the callers. Remove the places where log_ref_write_1() uses it, in preparation for making it internal to log_ref_setup(). Signed-off-by: Michael Haggerty --- refs/files-back

Re: [ANNOUNCE] git-test: run automated tests against a range of Git commits

2017-01-08 Thread Michael Haggerty
On 01/07/2017 08:18 AM, Jeff King wrote: > On Fri, Jan 06, 2017 at 04:52:16PM +0100, Michael Haggerty wrote: > >> I just released `git test`, a script for running automated >> tests across a range of Git commits and keeping track of the results in >> gi

Re: [ANNOUNCE] git-test: run automated tests against a range of Git commits

2017-01-11 Thread Michael Haggerty
On 01/10/2017 10:35 AM, Jeff King wrote: > On Sun, Jan 08, 2017 at 10:52:25AM +0100, Michael Haggerty wrote: >> [...] Since my last email, I have implemented a bunch of what we discussed [1]. Because of the new semantics, I also *renamed the main command* from git test range

problem with insider build for windows and git

2017-01-12 Thread Michael Gooch
when running commands like pull and clone I get the following message: Cygwin WARNING: Couldn't compute FAST_CWD pointer. This typically occurs if you're using an older Cygwin version on a newer Windows. Please update to the latest available Cygwin version from https://cygwin.com/. If th

Re: The design of refs backends, linked worktrees and submodules

2017-01-19 Thread Michael Haggerty
cts with a loose ref or vice versa. * Symrefs, which are loose, can point at packed references. I've taken some stabs at picking these apart into separate ref stores, but haven't had time to make very satisfying progress. By the time of GitMerge I might have a better feeling for whether I can devote some time to this project. Michael [1] https://github.com/mhagger/git

show all merge conflicts

2017-01-27 Thread Michael Spiegel
-free merge and a merge conflict that is resolved by with the changes from one the parents? Thanks, --Michael

[PATCH v3 2/2] rev-parse: fix some options when executed from subpath of main tree

2016-05-06 Thread Michael Rappazzo
hange this to return the proper relative path to the git directory. Related tests marked to expect failure are updated to expect success Signed-off-by: Michael Rappazzo --- builtin/rev-parse.c | 19 ++- t/t1500-rev-parse.sh | 4 ++-- t/t1700-split-index.sh | 2 +

[PATCH v3 1/2] rev-parse tests: add tests executed from a subdirectory

2016-05-06 Thread Michael Rappazzo
-dir which has been adjusted and marked to expect failure. Some of the tests added have been marked to expect failure. These demonstrate a problem with the way that some options to git rev-parse behave when executed from a subdirectory of the main worktree. Signed-off-by: Michael Rappazzo --- t

[PATCH v3 0/2] [PATCH v3 0/2] rev-parse: fix some options when executed from subpath of main tree

2016-05-06 Thread Michael Rappazzo
Differenced from v2[1]: - Rewrote the commits to just two; one that introduces tests, and one which fixes the problem. [1] http://thread.gmane.org/gmane.comp.version-control.git/292272 Michael Rappazzo (2): rev-parse tests: add tests executed from a subdirectory rev-parse: fix some

[PATCH v2 01/33] t1404: demonstrate a bug resolving references

2016-05-06 Thread Michael Haggerty
the reference exists as a packed ref. This probably hasn't been reported before because Git usually cleans up empty directories when packing references. This bug will be fixed shortly. Signed-off-by: Michael Haggerty --- t/t1404-update-ref-df-conflicts.sh

[PATCH v2 04/33] safe_create_leading_directories(): improve docstring

2016-05-06 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 v2 05/33] remove_dir_recursively(): add docstring

2016-05-06 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 v2 00/33] Yet more preparation for reference backends

2016-05-06 Thread Michael Haggerty
only handle REF_NODEREF mode": initialize `ref_name` only once, as its value can be reused. This patch series is also available from my GitHub repo [2] as branch "split-under-lock". [1] http://thread.gmane.org/gmane.comp.version-control.git/292772 [2] https://github.com/mhag

[PATCH v2 03/33] read_raw_ref(): don't get confused by an empty directory

2016-05-06 Thread Michael Haggerty
Even if there is an empty directory where we look for the loose version of a reference, check for a packed reference before giving up. This fixes the failing test that was introduced two commits ago. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 11 ++- t

[PATCH v2 06/33] refname_is_safe(): use skip_prefix()

2016-05-06 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 v2 07/33] refname_is_safe(): don't allow the empty string

2016-05-06 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 char *refname) free(buf

[PATCH v2 24/33] verify_refname_available(): adjust constness in declaration

2016-05-06 Thread Michael Haggerty
The two string_list arguments can be const. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 4 ++-- refs/refs-internal.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index ad53b6e..f0eef9e 100644 --- a/refs/files

[PATCH v2 15/33] read_raw_ref(): improve docstring

2016-05-06 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 v2 27/33] unlock_ref(): move definition higher in the file

2016-05-06 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 1c20af5..8ff76ed 100644 --- a

[PATCH v2 13/33] read_raw_ref(): clear *type at start of function

2016-05-06 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 fa8bbd6..8ced104 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c

[PATCH v2 23/33] refs: don't dereference on rename

2016-05-06 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 | 21 - t/t3200-branch.sh| 9 + 2 files change

[PATCH v2 17/33] lock_ref_sha1_basic(): remove unneeded local variable

2016-05-06 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 v2 08/33] refname_is_safe(): insist that the refname already be normalized

2016-05-06 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 --- refs.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index ca0280f..b18d995 100644 --- a/refs.c +++ b

[PATCH v2 31/33] lock_ref_for_update(): don't resolve symrefs

2016-05-06 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

[PATCH v2 25/33] add_update(): initialize the whole ref_update

2016-05-06 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 v2 12/33] read_raw_ref(): rename flags argument to type

2016-05-06 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 | 18 +- refs/refs-internal.h | 2 +

[PATCH v2 30/33] lock_ref_for_update(): don't re-read non-symbolic references

2016-05-06 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 v2 11/33] ref_transaction_commit(): remove local variable n

2016-05-06 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 80d346f..93a94af 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3076,7 +3076,6 @

[PATCH v2 19/33] ref_transaction_create(): disallow recursive pruning

2016-05-06 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 --- refs.c | 3 +++ refs/files-backend.c | 2 +- refs/refs-internal.h | 2

[PATCH v2 10/33] rename_ref(): remove unneeded local variable

2016-05-06 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 2d3a8c6..80d346f 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2360,20 +2360,17 @@ int

[PATCH v2 26/33] lock_ref_for_update(): new function

2016-05-06 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 v2 14/33] read_raw_ref(): rename symref argument to referent

2016-05-06 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 v2 32/33] commit_ref_update(): remove the flags parameter

2016-05-06 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 08ec293

[PATCH v2 16/33] read_raw_ref(): move docstring to header file

2016-05-06 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 38 -- refs/refs-internal.h | 38 ++ 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 73717dd

[PATCH v2 21/33] delete_branches(): use resolve_refdup()

2016-05-06 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 v2 02/33] commit_ref(): if there is an empty dir in the way, delete it

2016-05-06 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 24 1 file changed, 24 insertions(+) diff --git a/refs/files-backend.c b/refs/files-backend.c index 1f38076..ad9cd86 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2457,6 +2457,30 @@ static int

[PATCH v2 28/33] ref_transaction_update(): check refname_is_safe() at a minimum

2016-05-06 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 --- refs.c | 5 +++-- t/t1400

[PATCH v2 09/33] commit_ref_update(): write error message to *err, not stderr

2016-05-06 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 0cc116d..2d3a8c6 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2719,7 +2719,7 @@ static int

[PATCH v2 18/33] refs: make error messages more consistent

2016-05-06 Thread Michael Haggerty
* Always start error messages with a lower-case letter. * Always enclose reference names in single quotes. Signed-off-by: Michael Haggerty --- refs.c| 8 refs/files-backend.c | 32 t/t1400-update-ref.sh | 4 ++-- 3 files changed, 22

[PATCH v2 29/33] refs: resolve symbolic refs first

2016-05-06 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 v2 20/33] ref_transaction_commit(): correctly report close_ref() failure

2016-05-06 Thread Michael Haggerty
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 7cc680a..f4f7953 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3139,6 +3139,7 @@ int ref_transaction_commit(struct

[PATCH v2 22/33] refs: allow log-only updates

2016-05-06 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 v2 33/33] lock_ref_sha1_basic(): only handle REF_NODEREF mode

2016-05-06 Thread Michael Haggerty
_lock::orig_ref_name * Remove local variable orig_refname from lock_ref_sha1_basic() * ref_name can be initialize once and its value reused * commit_ref_update() never has to write to the reflog for lock->orig_ref_name Signed-off-by: Michael Haggerty --- refs/files-backen

Re: [PATCH v2 00/33] Yet more preparation for reference backends

2016-05-09 Thread Michael Haggerty
e breakage was fixed by the same fix, or whether it wasn't broken in the first place and the fix was unnecessary. Michael -- 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 v2 29/33] refs: resolve symbolic refs first

2016-05-13 Thread Michael Haggerty
also available from my GitHub repo [1] as branch "split-under-lock". Please note that there are still some calls of verify_refname_available_dir() against the loose reference cache in this function. If we wanted to give up a little bit on the quality of our error messages, I think we cou

[PATCH v3 29/33] refs: resolve symbolic refs first

2016-05-13 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

[Bug] git-log prints wrong unixtime with --date=format:%s

2016-05-16 Thread Michael Heerdegen
one helps: $ TZ=UTC git log --pretty=format:%ad --date=format:%s -1 Expected result: still 1463260938. Observed result: 1463268138 (7200s = 2 hours ahead). FWIW, personally I have not bound the TZ environment variable, my time zone is constantly that of Berlin, currently CEST. Many thanks i

Re: [Bug] git-log prints wrong unixtime with --date=format:%s

2016-05-17 Thread Michael Heerdegen
Michael Heerdegen writes: > the command > >git log --pretty=format:%ad --date=format:%s > > displays wrong unixtime values; apparently how much the printed value > differs from the expected value depends on the system's time zone and > whether daylight savings ti

Re: [Bug] git-log prints wrong unixtime with --date=format:%s

2016-05-18 Thread Michael Heerdegen
s rounded duration values (rounded hours in my case) in its log views, I think I just got confused because of this. In my tests now, the results were as expected. Thanks, Michael. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@v

Re: [Bug] git-log prints wrong unixtime with --date=format:%s

2016-05-18 Thread Michael Heerdegen
e format parsing needed). That's why it would be good if the unix time values could be relied on. Conclusion: in addition to 3., I wished both epoch times were also correct per se. Regards, Michael. -- To unsubscribe from this list: send the line "unsubscribe git" in the body

Re: [Bug] git-log prints wrong unixtime with --date=format:%s

2016-05-19 Thread Michael Heerdegen
Jeff King writes: > Oh, I agree that unix times are handy. I just think that "use %at in the > pretty-format, instead of %ad and then %s in the date-format" is not > such a bad workaround. I had missed %at (and %ct). Yes, works perfectly - thanks for the hint. Regar

[PATCH v4 1/2] rev-parse tests: add tests executed from a subdirectory

2016-05-26 Thread Michael Rappazzo
subdirectory of the main worktree. Signed-off-by: Michael Rappazzo --- t/t1500-rev-parse.sh | 28 t/t1700-split-index.sh | 17 + t/t2027-worktree-list.sh | 12 ++-- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/t/t1500-rev

[PATCH v4 2/2] rev-parse: fix some options when executed from subpath of main tree

2016-05-26 Thread Michael Rappazzo
hange this to return the proper relative path to the git directory. Related tests marked to expect failure are updated to expect success Signed-off-by: Michael Rappazzo --- builtin/rev-parse.c | 22 +- t/t1500-rev-parse.sh | 4 ++-- t/t1700-split-index.sh | 2 +

[PATCH v4 0/2] rev-parse: fix some options when executed from subpath of main tree

2016-05-26 Thread Michael Rappazzo
Changes since v3 [1]: - Rebased onto 'pu' which includes the cleanup of t1500 by Eric Sunshine - Fixed a memory leak due to misusing xstrfmt() [1] http://thread.gmane.org/gmane.comp.version-control.git/293778 Michael Rappazzo (2): rev-parse tests: add tests executed from a subdirec

[PATCH] Documentation: add instructions to help setup gmail 2FA

2016-05-27 Thread Michael Rappazzo
For those who use two-factor authentication with gmail, git-send-email will not work unless it is setup with an app-specific password. The example for setting up git-send-email for use with gmail will now include information on generating and storing the app-specific password. --- Documentation/gi

[PATCH 13/13] for_each_reflog(): reimplement using iterators

2016-05-30 Thread Michael Haggerty
fter this patch). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 113 --- refs/refs-internal.h | 7 2 files changed, 78 insertions(+), 42 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index a7cc0e2..2e0d0

[PATCH 07/13] entry_resolves_to_object(): rename function from ref_resolves_to_object()

2016-05-30 Thread Michael Haggerty
Free up the old name for a more general purpose. 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 142c977..1a46f32 100644 --- a/refs/files-backend.c +++ b/refs

[PATCH 11/13] for_each_reflog(): don't abort for bad references

2016-05-30 Thread Michael Haggerty
es for the purpose of determining object reachability!) and wouldn't benefit from a truncated iteration anyway. So instead, emit an error message and skip the "broken" reflog, but continue with the iteration. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 2 +- 1

[PATCH 00/13] Reference iterators

2016-05-30 Thread Michael Haggerty
f these changes, but I will work on that next. Michael [1] http://thread.gmane.org/gmane.comp.version-control.git/290409 [2] http://mid.gmane.org/89634d216544d1102dafd5d18247bff2581d48a8.1464537050.git.mhag...@alum.mit.edu [3] https://github.com/mhagger/git Michael Haggerty (13): refs: remove un

[PATCH 02/13] do_for_each_ref(): move docstring to the header file

2016-05-30 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 9 - refs/refs-internal.h | 10 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 1230dfb..68db3e8 100644 --- a/refs/files-backend.c +++ b/refs/files

[PATCH 09/13] refs: introduce an iterator interface

2016-05-30 Thread Michael Haggerty
trees and possibly other types of iterators in the future. Signed-off-by: Michael Haggerty --- Makefile | 1 + iterator.h | 81 refs.h | 4 +- refs/files-backend.c | 282 ++

[PATCH 04/13] delete_refs(): add a flags argument

2016-05-30 Thread Michael Haggerty
This will be useful for passing REF_NODEREF through. Signed-off-by: Michael Haggerty --- builtin/fetch.c | 2 +- builtin/remote.c | 4 ++-- refs.h | 5 +++-- refs/files-backend.c | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/builtin/fetch.c b

[PATCH 03/13] refs: use name "prefix" consistently

2016-05-30 Thread Michael Haggerty
In the context of the for_each_ref() functions, call the prefix that references must start with "prefix". (In some places it was called "base".) This is clearer, and also prevents confusion with another planned use of the word "base". Signed-off-by: Michael Hagge

[PATCH 01/13] refs: remove unnecessary "extern" keywords

2016-05-30 Thread Michael Haggerty
There's continuing work in this area, so clean up unneeded "extern" keywords rather than schlepping them around. Also split up some overlong lines and add parameter names in a couple of places. Signed-off-by: Michael Haggerty --

[PATCH 12/13] dir_iterator: new API for iterating over a directory tree

2016-05-30 Thread Michael Haggerty
. Signed-off-by: Michael Haggerty --- Makefile | 1 + dir-iterator.c | 180 + dir-iterator.h | 86 +++ 3 files changed, 267 insertions(+) create mode 100644 dir-iterator.c create mode 100644 dir-iterator.h

[PATCH 10/13] do_for_each_ref(): reimplement using reference iteration

2016-05-30 Thread Michael Haggerty
ation in a more straightforward manner. If we rewrite all callers to use the reference iteration API, then we can remove the current_ref_iter hack permanently. Signed-off-by: Michael Haggerty --- refs.c | 20 + refs/files-backend.c | 206 ++

[PATCH 06/13] get_ref_cache(): only create an instance if there is a submodule

2016-05-30 Thread Michael Haggerty
If there is not a nonbare repository where a submodule is supposedly located, then don't instantiate a ref_cache for it. The analogous check can be removed from resolve_gitlink_ref(). Signed-off-by: Michael Haggerty --- This doesn't actually reduce the number of ref_cache instances ge

[PATCH 08/13] ref_resolves_to_object(): new function

2016-05-30 Thread Michael Haggerty
Extract new function ref_resolves_to_object() from entry_resolves_to_object(). It can be used even if there is no ref_entry at hand. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 33 +++-- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a

[PATCH 05/13] remote rm: handle symbolic refs correctly

2016-05-30 Thread Michael Haggerty
option set to REF_NODEREF. Signed-off-by: Michael Haggerty --- builtin/remote.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index 1bbf9b4..c4b4d67 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -539,10 +539,6 @@ static int

Re: [PATCH 09/13] refs: introduce an iterator interface

2016-05-30 Thread Michael Haggerty
On 05/30/2016 06:57 PM, Ramsay Jones wrote: > > > On 30/05/16 16:22, Ramsay Jones wrote: >> >> >> On 30/05/16 08:55, Michael Haggerty wrote: >> [snip] >> >>> /* Reference is a symbolic reference. */ >>> diff --git a/refs/files-backend.c

Re: [PATCH 1/2] strbuf: add tests

2016-05-30 Thread Michael Haggerty
uf_check_behavior")) { > + strbuf_init(&sb, 0); > + return test_usual(&sb); > + } else if (!strcmp(argv[1], "grow_overflow")) { > + /* > + * size_t overflow: should die() > + */ > + strbuf_init(&sb, 1000); > + strbuf_grow(&sb, maximum_unsigned_value_of_type((size_t)1)); > + } else { > + usage("test-strbuf mode"); > + } Consider putting each test in a separate function, rather than implementing some tests inline and one as a function. Consistency makes code easier to read. > [...] Michael -- 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] strbuf: allow to use preallocated memory

2016-05-30 Thread Michael Haggerty
et a strbuf passed to it from a caller, and that caller might someday be modified to use stack-allocated strings. So I think that at least the valgrind test suggested above would be prudent. Michael [1] https://github.com/git/git/blob/f3913c2d03abc660140678a9e14dac399f847647/strbuf.h#L20-L23 -- To

Re: [PATCH 2/2] strbuf: allow to use preallocated memory

2016-05-30 Thread Michael Haggerty
be named more like `strbuf_attach()` to emphasize their similarity to that existing function. Maybe strbuf_attach_fixed(struct strbuf *sb, void *s, size_t len, size_t alloc); strbuf_attach_movable(struct strbuf *sb, void *s, size_t len, size_t alloc); Michael -- To unsubscribe from this

Re: [RFC/PATCH] bisect--helper: `bisect_clean_state` shell function in C

2016-05-30 Thread Michael Haggerty
) function in builtin/remote.c [2] for an example. [1] https://github.com/git/git/blob/f3913c2d03abc660140678a9e14dac399f847647/refs.h#L176-L184 [2] https://github.com/git/git/blob/f3913c2d03abc660140678a9e14dac399f847647/builtin/remote.c#L738 > [...] Michael -- To unsubscribe from this list:

Re: [PATCH 09/13] refs: introduce an iterator interface

2016-05-31 Thread Michael Haggerty
On 05/31/2016 07:29 AM, Eric Sunshine wrote: > On Mon, May 30, 2016 at 3:55 AM, Michael Haggerty > wrote: >> [...] > [...] > Either: > > s/false/something other than ITER_OK/ > > or: > > s/false/ITER_DONE or ITER_ERROR/ Thanks. >> +in

Re: [PATCH 2/2] strbuf: allow to use preallocated memory

2016-05-31 Thread Michael Haggerty
On 05/31/2016 08:41 AM, Johannes Schindelin wrote: > Hi Michael, > > On Tue, 31 May 2016, Michael Haggerty wrote: > >> On 05/30/2016 02:13 PM, Johannes Schindelin wrote: >>> [...] >>>> @@ -38,7 +67,11 @@ char *strbuf_detach(struct strbuf *sb

<    5   6   7   8   9   10   11   12   13   14   >