Re: [PATCH v2 2/2] config: Add hashtable for config parsing & retrieval

2014-06-16 Thread Jeff King
On Tue, Jun 17, 2014 at 01:34:36AM -0400, Jeff King wrote: > You need some mechanism to store entries that are NULL. It may be enough > to silently convert them into the string "true" inside the cached > storage. But there may be callers who treat NULL specially (e.g., a > tri-state true/false/aut

Re: [PATCH/RFC] alias.c: Replace git_config with git_config_get_string

2014-06-16 Thread Jeff King
On Mon, Jun 16, 2014 at 02:15:54AM -0700, Tanay Abhra wrote: > **DOUBT** > This patch builds on top of patch series[1]. The first patch in the > replace `git_config` series is [2], which passed all the tests. > > But this patch falters at this test in t1300-repo-config.sh, > > git config alias.

Re: [PATCH v2 2/2] config: Add hashtable for config parsing & retrieval

2014-06-16 Thread Jeff King
On Mon, Jun 16, 2014 at 01:27:12AM -0700, Tanay Abhra wrote: > +static int config_cache_callback(const char *key, const char *value, void > *unused) > +{ > + config_cache_set_value(key, value); > + return 0; > +} This gets the normalized key, which is good; you should be able to just has

[PATCH v9] refs.c: SSE2 optimizations for check_refname_component

2014-06-16 Thread David Turner
Optimize check_refname_component using SSE2 on x86_64. git rev-parse HEAD is a good test-case for this, since it does almost nothing except parse refs. For one particular repo with about 60k refs, almost all packed, the timings are: Look up table: 29 ms SSE2: 23 ms This cuts about 20%

[PATCH v2] http-protocol.txt: Basic Auth is RFC 2617, not RFC 2616

2014-06-16 Thread Yi, EungJun
From: Yi EungJun Signed-off-by: Yi EungJun --- Documentation/technical/http-protocol.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/technical/http-protocol.txt b/Documentation/technical/http-protocol.txt index 544373b..2d0eb19 100644 --- a/Documentation/te

Re: [PATCH] http-protocol.txt: Basic Auth is RFC 2617, not RFC 2616

2014-06-16 Thread Yi, EungJun
Thanks for your advice. i'll resend it. 2014-06-17 3:26 GMT+09:00 Junio C Hamano : > Yi EungJun writes: > >> Could you change the author to "Yi EungJun " >> if you apply this patch? > > You can send a patch with the desired "From: " line that matches the > identity on the "Signed-off-by: " line a

Re: [PATCH v8] refs.c: SSE2 optimizations for check_refname_component

2014-06-16 Thread David Turner
On Mon, 2014-06-16 at 17:06 -0700, Junio C Hamano wrote: > David Turner writes: > > > Optimize check_refname_component using SSE2 on x86_64. > > > > git rev-parse HEAD is a good test-case for this, since it does almost > > nothing except parse refs. For one particular repo with about 60k > > ref

Re: [PATCH v17 16/48] refs.c: add an err argument to delete_ref_loose

2014-06-16 Thread Junio C Hamano
The series applies cleanly up to 25/48 or so to 'master', but this step already breaks tests, at least t1400 but possibly others. Please do not make me bisect X-<. Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More

[PATCH 5/5] pretty: avoid reading past end-of-string with "%G"

2014-06-16 Thread Jeff King
If the user asks for --format=%G with nothing else, we correctly realize that "%G" is not a valid placeholder (it should be "%G?", "%GK", etc). But we still tell the strbuf_expand code that we consumed 2 characters, causing it to jump over the trailing NUL and output garbage. This also fixes the c

Re: [PATCH v8] refs.c: SSE2 optimizations for check_refname_component

2014-06-16 Thread Junio C Hamano
David Turner writes: > Optimize check_refname_component using SSE2 on x86_64. > > git rev-parse HEAD is a good test-case for this, since it does almost > nothing except parse refs. For one particular repo with about 60k > refs, almost all packed, the timings are: > > Look up table: 29 ms > SSE2:

[PATCH 4/5] t7510: check %G* pretty-format output

2014-06-16 Thread Jeff King
We do not check these along with the other pretty-format placeholders in t6006, because we need signed commits to make them interesting. t7510 has such commits, and can easily exercise them in addition to the regular --show-signature code path. Signed-off-by: Jeff King --- Similar to before, but

[PATCH 3/5] t7510: test a commit signed by an unknown key

2014-06-16 Thread Jeff King
We tested both good and bad signatures, but not ones made correctly but with a key for which we have no trust. Signed-off-by: Jeff King --- I'm not happy about grepping more gpg output, but perhaps this "not certified" is no worse than the current 'Good signature from" greps we have? The interna

[PATCH 2/5] t7510: use consistent &&-chains in loop

2014-06-16 Thread Jeff King
From: Michael J Gruber We check multiple commits in a loop. Because we want to break out of the loop if any single iteration fails, we use a subshell/exit like: ( for i in $stuff do do-something $i || exit 1 done ) However, we are inconsistent in our

[PATCH 1/5] t7510: stop referring to master in later tests

2014-06-16 Thread Jeff King
Our setup creates a sequence of commits, each with its own tag. However, we sometimes refer to "seventh-signed" as "master". This works, since it is at the tip of the created branch, but is brittle if new tests need to add more commits. Let's use its tag name to be unambiguous. Signed-off-by: Jeff

[PATCH 0/5] --format=%G tests and fixes

2014-06-16 Thread Jeff King
On Mon, Jun 16, 2014 at 07:36:49PM -0400, Jeff King wrote: > On Mon, Jun 16, 2014 at 05:50:14PM -0400, Eric Sunshine wrote: > > > > +test_expect_success GPG 'show good signature with custom format' ' > > > + cat >expect <<-\EOF > > > > Broken &&-chain (and in tests below). > > Whoops, tha

Re: [PATCH] t7510: check %G* pretty-format output

2014-06-16 Thread Jeff King
On Mon, Jun 16, 2014 at 05:50:14PM -0400, Eric Sunshine wrote: > > +test_expect_success GPG 'show good signature with custom format' ' > > + cat >expect <<-\EOF > > Broken &&-chain (and in tests below). Whoops, thanks. Re-roll coming in a minute. I'm also reorganizing the two patches a bit

Re: [PATCH v2 1/2] string-list: Add string_list initializer helper functions

2014-06-16 Thread Junio C Hamano
Tanay Abhra writes: > When a compound construct like a string_list within another > struct is used, the default initializer macros are useless. > For such cases add helper functions for string_list > initialization for both DUP and NODUP modes. > > Signed-off-by: Tanay Abhra > --- Sorry, but I

Re: [PATCH 02/14] submodules: Add the lib-submodule-update.sh test library

2014-06-16 Thread Junio C Hamano
Jens Lehmann writes: > Add this test library to simplify covering all combinations of submodule > update scenarios without having to add those to a test of each work tree > manipulating command over and over again. > > The functions test_submodule_switch() and test_submodule_forced_switch() > are

Re: [PATCH v5 4/4] commit: Add commit.verbose configuration

2014-06-16 Thread Junio C Hamano
Caleb Thompson writes: >> Again, what are we testing, exactly? >> >> We do not want to see "^diff --git" in the output file, in other >> words, we want to make sure "^diff --git" does not appear in the >> output. >> >> So >> >> write_script check-for-no-diff <<-\EOF >> ! grep '^di

Re: [PATCH 01/14] test-lib: add test_dir_is_empty()

2014-06-16 Thread Junio C Hamano
Jens Lehmann writes: > For the upcoming submodule test framework we often need to assert that an > empty directory exists in the work tree. Add the test_dir_is_empty() > function which asserts that the given argument is an empty directory. > > Signed-off-by: Jens Lehmann > --- > t/test-lib-func

Re: [PATCH] t7510: check %G* pretty-format output

2014-06-16 Thread Eric Sunshine
On Mon, Jun 16, 2014 at 4:26 PM, Jeff King wrote: > On Mon, Jun 16, 2014 at 04:13:11PM -0400, Jeff King wrote: > >> It doesn't look like we have any tests of "%G*" and friends at all. :( > > Maybe we can add this: > > -- >8 -- > Subject: t7510: check %G* pretty-format output > > We do not check th

Re: [PATCH] doc git: multivar configuration parameters append to existing values

2014-06-16 Thread Junio C Hamano
"Philip Oakley" writes: >> ---once >> the reader >> understands that Git reads all configuration varilables of the >> same name and the code paths that *use* one of them pick the one >> defined the last, > It's this step tha

Re: [PATCH 3/3] verify-commit: scriptable commit signature verification

2014-06-16 Thread Jeff King
On Mon, Jun 16, 2014 at 01:34:20PM -0700, Junio C Hamano wrote: > > Your middle example above did make me think of one other thing, though. > > As you noted, we actually have _three_ signature types: > > > > 1. signed tags > > > > 2. signed commits > > > > 3. merges with embedded mergetag he

Re: [PATCH 3/3] verify-commit: scriptable commit signature verification

2014-06-16 Thread Junio C Hamano
Jeff King writes: > On Fri, Jun 13, 2014 at 10:06:10AM -0700, Junio C Hamano wrote: > ... >> and more, perhaps? > > That is certainly the direction I was thinking of when I suggested "git > verify". > > However, I do not think it is too bad a thing to add a verify-commit > that matches verify-tag

Re: [PATCH] rebase--merge: fix --skip with two conflicts in a row

2014-06-16 Thread Junio C Hamano
"brian m. carlson" writes: > If git rebase --merge encountered a conflict, --skip would not work if the > next commit also conflicted. The msgnum file would never be updated with > the new patch number, so no patch would actually be skipped, resulting in an > inescapable loop. > > Update the msg

Re: [PATCH v5 0/4] commit: Add commit.verbose configuration

2014-06-16 Thread Junio C Hamano
Jeremiah Mahler writes: > On Fri, Jun 13, 2014 at 11:49:10AM -0500, Caleb Thompson wrote: > ... >> > The patches look good, they apply clean ('git am'), and all tests pass. >> > >> > Reviewed-by: Jeremiah Mahler >> >> So that I'm clear on the etiquitte, is it appropriate for me to add this >> R

[PATCH] t7510: check %G* pretty-format output

2014-06-16 Thread Jeff King
On Mon, Jun 16, 2014 at 04:13:11PM -0400, Jeff King wrote: > It doesn't look like we have any tests of "%G*" and friends at all. :( Maybe we can add this: -- >8 -- Subject: t7510: check %G* pretty-format output We do not check these along with the other pretty-format placeholders in t6006, beca

Re: [PATCH 2/3] tree-walk: simplify via strnncmp()

2014-06-16 Thread Jonathan Nieder
Jeremiah Mahler wrote: > --- a/tree-walk.c > +++ b/tree-walk.c [...] > @@ -174,7 +164,7 @@ static int check_entry_match(const char *a, int a_len, > const char *b, int b_len) >* scanning further. >*/ > > - int cmp = name_compare(a, a_len, b, b_len); > + int cmp = strnncmp

Re: [PATCH 3/3] unpack-trees: simplify via strnncmp()

2014-06-16 Thread Jonathan Nieder
Jeremiah Mahler wrote: > --- a/unpack-trees.c > +++ b/unpack-trees.c [...] > @@ -678,7 +667,7 @@ static int find_cache_pos(struct traverse_info *info, > ce_len = ce_slash - ce_name; > else > ce_len = ce_namelen(ce) - pfxlen; > -

Re: [PATCH 1/3] add strnncmp() function

2014-06-16 Thread Jonathan Nieder
Jeremiah Mahler wrote: > Add a strnncmp() function which behaves like strncmp() except it uses > the length of both strings instead of just one. The above description isn't very clear to me. Problems: - strncmp compares prefixes of \0-terminated strings. This function compares two binary b

[PATCH] pretty: avoid reading past end-of-string with "%G"

2014-06-16 Thread Jeff King
If the user asks for --format=%G with nothing else, we correctly realize that "%G" is not a valid placeholder (it should be "%G?", "%GK", etc). But we still tell the strbuf_expand code that we consumed 2 characters, causing it to jump over the trailing NUL and output garbage. This also fixes the c

Re: [PATCH v5 4/4] commit: Add commit.verbose configuration

2014-06-16 Thread Caleb Thompson
On Mon, Jun 16, 2014 at 01:06:45PM -0700, Junio C Hamano wrote: > Caleb Thompson writes: > > > On Fri, Jun 13, 2014 at 10:48:55AM -0700, Junio C Hamano wrote: > >> Caleb Thompson writes: > >> > >> > diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh > >> > index 35a4d06..402d6a1 1

Re: [PATCH v5 4/4] commit: Add commit.verbose configuration

2014-06-16 Thread Junio C Hamano
Caleb Thompson writes: > On Fri, Jun 13, 2014 at 10:48:55AM -0700, Junio C Hamano wrote: >> Caleb Thompson writes: >> >> > diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh >> > index 35a4d06..402d6a1 100755 >> > --- a/t/t7507-commit-verbose.sh >> > +++ b/t/t7507-commit-verbose.

Re: [PATCH v5 4/4] commit: Add commit.verbose configuration

2014-06-16 Thread Caleb Thompson
On Mon, Jun 16, 2014 at 02:50:57PM -0500, Caleb Thompson wrote: > On Fri, Jun 13, 2014 at 10:48:55AM -0700, Junio C Hamano wrote: > > Caleb Thompson writes: > > > > > diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh > > > index 35a4d06..402d6a1 100755 > > > --- a/t/t7507-commit-v

Re: [PATCH] doc: State coding guideline for error message punctuation

2014-06-16 Thread Philip Oakley
From: "Junio C Hamano" Philip Oakley writes: Clarify error message puntuation to reduce review workload [1]. [1] http://article.gmane.org/gmane.comp.version-control.git/251547 (see trailing 'nit' item). Signed-off-by: Philip Oakley --- Hmmm. Do we really need to spell everything out? It

Re: [PATCH 3/3] verify-commit: scriptable commit signature verification

2014-06-16 Thread Jeff King
On Fri, Jun 13, 2014 at 10:06:10AM -0700, Junio C Hamano wrote: > Jeff King writes: > > > I realize this isn't really your itch to scratch. It's just that when I > > see a description like "verify a commit", I wonder what exactly "verify" > > means. > > I think that is an important point. If a

Re: [PATCH v5 4/4] commit: Add commit.verbose configuration

2014-06-16 Thread Caleb Thompson
On Fri, Jun 13, 2014 at 10:48:55AM -0700, Junio C Hamano wrote: > Caleb Thompson writes: > > > diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh > > index 35a4d06..402d6a1 100755 > > --- a/t/t7507-commit-verbose.sh > > +++ b/t/t7507-commit-verbose.sh > > @@ -7,6 +7,10 @@ write_scr

Re: [PATCH] doc git: multivar configuration parameters append to existing values

2014-06-16 Thread Jeff King
On Mon, Jun 16, 2014 at 11:43:32AM -0700, Junio C Hamano wrote: > I have two doubts, while appreciating the overall direction to > clarify things very much. > > * "single overrides, multiple appends" is not a wrong explanation >per-se, but sounds like an arbitrary rule that forces people to

Re: [PATCH] doc git: multivar configuration parameters append to existing values

2014-06-16 Thread Philip Oakley
From: "Tanay Abhra" On 06/16/2014 05:49 AM, Philip Oakley wrote: Pass a configuration parameter to the command. The value - given will override values from configuration files. + given will override single valued variables from configuration + files, and append to multivar variables. Previous

Re: [PATCH] doc git: multivar configuration parameters append to existing values

2014-06-16 Thread Philip Oakley
From: "Junio C Hamano" Philip Oakley writes: When the '-c' option is used to pass alternate URLs or similar multivar parameters to git commands the effect is not what the user expected [1,2]. Clarify that multivar configuration parameters do not supercede previous values. Suggest an alternat

[PATCH v8] refs.c: SSE2 optimizations for check_refname_component

2014-06-16 Thread David Turner
Optimize check_refname_component using SSE2 on x86_64. git rev-parse HEAD is a good test-case for this, since it does almost nothing except parse refs. For one particular repo with about 60k refs, almost all packed, the timings are: Look up table: 29 ms SSE2: 23 ms This cuts about 20%

Re: [PATCH] http: fix charset detection of extract_content_type()

2014-06-16 Thread Jeff King
On Mon, Jun 16, 2014 at 11:29:39AM -0700, Junio C Hamano wrote: > nori writes: > > > extract_content_type() could not extract a charset parameter if the > > parameter is not the first one and there is a whitespace and a following > > semicolon just before the parameter. For example: > > > >

[PATCH 2/3] tree-walk: simplify via strnncmp()

2014-06-16 Thread Jeremiah Mahler
Simplify tree-walk.c using the strnncmp() function and remove the name_compare() function. Signed-off-by: Jeremiah Mahler --- tree-walk.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tree-walk.c b/tree-walk.c index 4dc86c7..efbd3b7 100644 --- a/tree-walk.

[PATCH 1/3] add strnncmp() function

2014-06-16 Thread Jeremiah Mahler
Add a strnncmp() function which behaves like strncmp() except it uses the length of both strings instead of just one. Signed-off-by: Jeremiah Mahler --- strbuf.c | 6 ++ strbuf.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/strbuf.c b/strbuf.c index ac62982..bd486c3 100644 --- a/st

[PATCH 3/3] unpack-trees: simplify via strnncmp()

2014-06-16 Thread Jeremiah Mahler
Simplify unpack-trees.c using the strnncmp() function and remove the name_compare() function. Signed-off-by: Jeremiah Mahler --- unpack-trees.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/unpack-trees.c b/unpack-trees.c index 4a9cdf2..9a71b5a 100644 --- a/un

[PATCH 0/3] add strnncmp() function

2014-06-16 Thread Jeremiah Mahler
Add a strnncmp() function which behaves like strncmp() except it uses the length of both strings instead of just one. Then simplify tree-walk.c and unpack-trees.c using this new function. Replace all occurances of name_compare() with strnncmp(). Remove name_compare(), which they both had identica

Re: [PATCH v5 3/4] commit test: test_set_editor in each test

2014-06-16 Thread Junio C Hamano
Caleb Thompson writes: > On Fri, Jun 13, 2014 at 07:41:29PM -0400, Jeff King wrote: >> On Fri, Jun 13, 2014 at 10:42:26AM -0700, Junio C Hamano wrote: >> >> > Jeff King writes: >> > >> > > [1] It might make sense for test_set_editor, when run from within a >> > > test, to behave more like te

Re: [PATCH] doc: State coding guideline for error message punctuation

2014-06-16 Thread Junio C Hamano
Philip Oakley writes: > Clarify error message puntuation to reduce review workload [1]. > > [1] http://article.gmane.org/gmane.comp.version-control.git/251547 > (see trailing 'nit' item). > > Signed-off-by: Philip Oakley > --- Hmmm. Do we really need to spell everything out? I would rather ho

Re: [PATCH] doc git: multivar configuration parameters append to existing values

2014-06-16 Thread Junio C Hamano
Philip Oakley writes: > When the '-c' option is used to pass alternate URLs or similar > multivar parameters to git commands the effect is not what the user > expected [1,2]. > > Clarify that multivar configuration parameters do not supercede > previous values. Suggest an alternative style parame

Re: [PATCH] doc git: multivar configuration parameters append to existing values

2014-06-16 Thread Tanay Abhra
On 06/16/2014 05:49 AM, Philip Oakley wrote: > Pass a configuration parameter to the command. The value > - given will override values from configuration files. > + given will override single valued variables from configuration > + files, and append to multivar variables. Previou

Re: [PATCH] http: fix charset detection of extract_content_type()

2014-06-16 Thread Junio C Hamano
nori writes: > extract_content_type() could not extract a charset parameter if the > parameter is not the first one and there is a whitespace and a following > semicolon just before the parameter. For example: > > text/plain; format=fixed ;charset=utf-8 > > Signed-off-by: Yi EungJun > --- P

Re: [PATCH] http-protocol.txt: Basic Auth is RFC 2617, not RFC 2616

2014-06-16 Thread Junio C Hamano
Yi EungJun writes: > Could you change the author to "Yi EungJun " > if you apply this patch? You can send a patch with the desired "From: " line that matches the identity on the "Signed-off-by: " line at the beginning of the log message, like this: From: nori Subject: [PATCH] h

Re: pre-commit hook question

2014-06-16 Thread Junio C Hamano
Nick Dimov writes: > Im struggling for a couple of hours to make git store metadata of the > files using metastore and I use hooks/pre-commit for this. The pre-commit hook is about checking if the commits being created is sensible and rejecting otherwise, and it is not designed to allow futzing

Re: [PATCH] gitk: use mktemp -d to avoid predictable temporary directories

2014-06-16 Thread Junio C Hamano
David Aguilar writes: > Hmm.. I guess what I could do is keep the old behavior (having gitk ignore > TMPDIR) > on Windows and only use the new code path on non-Windows. Or perhaps attempt to create, catch error and then retry the old way? Hopefully Windows folks do not have to worry about forg

[PATCH v17 13/48] refs.c: make resolve_ref_unsafe set errno to something meaningful on error

2014-06-16 Thread Ronnie Sahlberg
Making errno when returning from resolve_ref_unsafe() meaningful, which should fix * a bug in lock_ref_sha1_basic, where it assumes EISDIR means it failed due to a directory being in the way Signed-off-by: Ronnie Sahlberg --- cache.h | 2 +- refs.c | 19 +++ 2 files change

[PATCH v17 16/48] refs.c: add an err argument to delete_ref_loose

2014-06-16 Thread Ronnie Sahlberg
Add an err argument to delete_loose_ref so that we can pass a descriptive error string back to the caller. Pass the err argument from transaction commit to this function so that transaction users will have a nice error string if the transaction failed due to delete_loose_ref. Add a new function un

[PATCH v17 25/48] tag.c: use ref transactions when doing updates

2014-06-16 Thread Ronnie Sahlberg
Change tag.c to use ref transactions for all ref updates. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/tag.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/builtin/tag.c b/builtin/tag.c index c6e8a71..c9bfc9a 100644 --- a/builtin/t

[PATCH v17 33/48] fast-import.c: use a ref transaction when dumping tags

2014-06-16 Thread Ronnie Sahlberg
Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- fast-import.c | 29 +++-- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/fast-import.c b/fast-import.c index 0752f0a..42a607d 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1730,15 +1730,3

[PATCH v17 03/48] refs.c: constify the sha arguments for ref_transaction_create|delete|update

2014-06-16 Thread Ronnie Sahlberg
ref_transaction_create|delete|update has no need to modify the sha1 arguments passed to it so it should use const unsigned char* instead of unsigned char*. Some functions, such as fast_forward_to(), already have its old/new sha1 arguments as consts. This function will at some point need to use ref

[PATCH v17 15/48] refs.c: make ref_update_reject_duplicates take a strbuf argument for errors

2014-06-16 Thread Ronnie Sahlberg
Make ref_update_reject_duplicates return any error that occurs through a new strbuf argument. This means that when a transaction commit fails in this function we will now be able to pass a helpful error message back to the caller. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg ---

[PATCH v17 21/48] refs.c: change ref_transaction_create to do error checking and return status

2014-06-16 Thread Ronnie Sahlberg
Do basic error checking in ref_transaction_create() and make it return non-zero on error. Update all callers to check the result of ref_transaction_create(). There are currently no conditions in _create that will return error but there will be in the future. Add an err argument that will be updated

[PATCH v17 32/48] receive-pack.c: use a reference transaction for updating the refs

2014-06-16 Thread Ronnie Sahlberg
Wrap all the ref updates inside a transaction. Signed-off-by: Ronnie Sahlberg --- builtin/receive-pack.c | 96 +- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index c323081..b51f8ae

[PATCH v17 00/48] Use ref transactions

2014-06-16 Thread Ronnie Sahlberg
This patch series can also be found at https://github.com/rsahlberg/git/tree/ref-transactions This patch series is based on next and expands on the transaction API. It converts all ref updates, inside refs.c as well as external, to use the transaction API for updates. This makes most of the ref up

[PATCH v17 07/48] lockfile.c: make lock_file return a meaningful errno on failurei

2014-06-16 Thread Ronnie Sahlberg
Making errno when returning from lock_file() meaningful, which should fix * an existing almost-bug in lock_ref_sha1_basic where it assumes errno==ENOENT is meaningful and could waste some work on retries * an existing bug in repack_without_refs where it prints strerror(errno) and picks ad

[PATCH v17 28/48] sequencer.c: use ref transactions for all ref updates

2014-06-16 Thread Ronnie Sahlberg
Change to use ref transactions for all updates to refs. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- sequencer.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sequencer.c b/sequencer.c index 0a80c58..fd8acaf 100644 --- a/sequenc

[PATCH v17 30/48] branch.c: use ref transaction for all ref updates

2014-06-16 Thread Ronnie Sahlberg
Change create_branch to use a ref transaction when creating the new branch. This also fixes a race condition in the old code where two concurrent create_branch could race since the lock_any_ref_for_update/write_ref_sha1 did not protect against the ref already existing. I.e. one thread could end up

[PATCH v17 09/48] refs.c: make sure log_ref_setup returns a meaningful errno

2014-06-16 Thread Ronnie Sahlberg
Making errno when returning from log_ref_setup() meaningful, Signed-off-by: Ronnie Sahlberg --- refs.c | 29 - refs.h | 4 +++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index b4b05bd..6f85bd8 100644 --- a/refs.c +++ b/refs.c @@

[PATCH v17 02/48] refs.c: ref_transaction_commit should not free the transaction

2014-06-16 Thread Ronnie Sahlberg
Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 1 + refs.c | 1 - refs.h | 5 ++--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 405267f..1fd7a89 100644 --- a/b

[PATCH v17 05/48] refs.c: add a strbuf argument to ref_transaction_commit for error logging

2014-06-16 Thread Ronnie Sahlberg
Add a strbuf argument to _commit so that we can pass an error string back to the caller. So that we can do error logging from the caller instead of from _commit. Longer term plan is to first convert all callers to use onerr==QUIET_ON_ERR and craft any log messages from the callers themselves and f

[PATCH v17 14/48] refs.c: log_ref_write should try to return meaningful errno

2014-06-16 Thread Ronnie Sahlberg
Making errno from write_ref_sha1() meaningful, which should fix * a bug in "git checkout -b" where it prints strerror(errno)  despite errno possibly being zero or clobbered * a bug in "git fetch"'s s_update_ref, which trusts the result of an  errno == ENOTDIR check to detect D/F conflicts Sign

[PATCH v17 31/48] refs.c: change update_ref to use a transaction

2014-06-16 Thread Ronnie Sahlberg
Change the update_ref helper function to use a ref transaction internally. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index b75523f..50e5475 100644 --- a/re

[PATCH v17 12/48] refs.c: commit_packed_refs to return a meaningful errno on failure

2014-06-16 Thread Ronnie Sahlberg
Making errno when returning from commit_packed_refs() meaningful, which should fix * a bug in "git clone" where it prints strerror(errno) based on errno, despite errno possibly being zero and potentially having been clobbered by that point * the same kind of bug in "git pack-refs" and pre

[PATCH v17 06/48] lockfile.c: add a new public function unable_to_lock_message

2014-06-16 Thread Ronnie Sahlberg
Introducing a new unable_to_lock_message helper, which has nicer semantics than unable_to_lock_error and cleans up lockfile.c a little. Signed-off-by: Ronnie Sahlberg --- cache.h| 2 ++ lockfile.c | 22 -- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/

[PATCH v17 01/48] refs.c: remove ref_transaction_rollback

2014-06-16 Thread Ronnie Sahlberg
We do not yet need both a rollback and a free function for transactions. Remove ref_transaction_rollback and use ref_transaction_free instead. At a later stage we may reintroduce a rollback function if we want to start adding reusable transactions and similar. Reviewed-by: Jonathan Nieder Signed

[PATCH v17 11/48] refs.c: make remove_empty_directories alwasy set errno to something sane

2014-06-16 Thread Ronnie Sahlberg
Making errno when returning from remove_empty_directories() more obviously meaningful, which should provide some peace of mind for people auditing lock_ref_sha1_basic. Signed-off-by: Ronnie Sahlberg --- refs.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.

[PATCH v17 22/48] refs.c: update ref_transaction_delete to check for error and return status

2014-06-16 Thread Ronnie Sahlberg
Change ref_transaction_delete() to do basic error checking and return non-zero of error. Update all callers to check the return for ref_transaction_delete(). There are currently no conditions in _delete that will return error but there will be in the future. Add an err argument that will be updated

[PATCH v17 17/48] refs.c: make update_ref_write update a strbuf on failure

2014-06-16 Thread Ronnie Sahlberg
Change update_ref_write to also update an error strbuf on failure. This makes the error available to ref_transaction_commit callers if the transaction failed due to update_ref_sha1/write_ref_sha1 failures. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 9 ++--- 1 f

[PATCH v17 18/48] update-ref: use err argument to get error from ref_transaction_commit

2014-06-16 Thread Ronnie Sahlberg
Call ref_transaction_commit with QUIET_ON_ERR and use the strbuf that is returned to print a log message if/after the transaction fails. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --

[PATCH v17 23/48] refs.c: make ref_transaction_begin take an err argument

2014-06-16 Thread Ronnie Sahlberg
Add an err argument to _begin so that on non-fatal failures in future ref backends we can report a nice error back to the caller. While _begin can currently never fail for other reasons than OOM, in which case we die() anyway, we may add other types of backends in the future. For example, a hypothe

[PATCH v17 08/48] refs.c: add an err argument to repack_without_refs

2014-06-16 Thread Ronnie Sahlberg
Update repack_without_refs to take an err argument and update it if there is a failure. Pass the err variable from ref_transaction_commit to this function so that callers can print a meaningful error message if _commit fails due to this function. Signed-off-by: Ronnie Sahlberg --- refs.c | 19 ++

[PATCH v17 19/48] refs.c: remove the onerr argument to ref_transaction_commit

2014-06-16 Thread Ronnie Sahlberg
Since all callers now use QUIET_ON_ERR we no longer need to provide an onerr argument any more. Remove the onerr argument from the ref_transaction_commit signature. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 3 +-- refs.c | 22 +++--

[PATCH v17 24/48] refs.c: add transaction.status and track OPEN/CLOSED/ERROR

2014-06-16 Thread Ronnie Sahlberg
Track the status of a transaction in a new status field. Check the field for sanity, i.e. that status must be OPEN when _commit/_create/_delete or _update is called or else die(BUG:...) Signed-off-by: Ronnie Sahlberg --- refs.c | 40 +++- 1 file changed, 39 in

[PATCH v17 10/48] refs.c: verify_lock should set errno to something meaningful

2014-06-16 Thread Ronnie Sahlberg
Making errno when returning from verify_lock() meaningful, which should almost but not completely fix * a bug in "git fetch"'s s_update_ref, which trusts the result of an errno == ENOTDIR check to detect D/F conflicts ENOTDIR makes sense as a sign that a file was in the way of a directory we

[PATCH v17 20/48] refs.c: change ref_transaction_update() to do error checking and return status

2014-06-16 Thread Ronnie Sahlberg
Update ref_transaction_update() do some basic error checking and return non-zero on error. Update all callers to check ref_transaction_update() for error. There are currently no conditions in _update that will return error but there will be in the future. Add an err argument that will be updated on

[PATCH v17 43/48] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-06-16 Thread Ronnie Sahlberg
Move the check for check_refname_format from lock_any_ref_for_update to lock_ref_sha1_basic. At some later stage we will get rid of lock_any_ref_for_update completely. If lock_ref_sha1_basic fails the check_refname_format test, set errno to EINVAL before returning NULL. This to guarantee that we w

[PATCH v17 48/48] refs.c: make write_ref_sha1 static

2014-06-16 Thread Ronnie Sahlberg
No external users call write_ref_sha1 any more so lets declare it static. Signed-off-by: Ronnie Sahlberg --- refs.c | 10 -- refs.h | 3 --- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index 47575e8..cb56e38 100644 --- a/refs.c +++ b/refs.c @@ -2639,6

[PATCH v17 45/48] refs.c: pass a skip list to name_conflict_fn

2014-06-16 Thread Ronnie Sahlberg
Allow passing a list of refs to skip checking to name_conflict_fn. There are some conditions where we want to allow a temporary conflict and skip checking those refs. For example if we have a transaction that 1, guarantees that m is a packed refs and there is no loose ref for m 2, the transaction w

[PATCH v17 38/48] refs.c: remove lock_ref_sha1

2014-06-16 Thread Ronnie Sahlberg
lock_ref_sha1 was only called from one place in refc.c and only provided a check that the refname was sane before adding back the initial "refs/" part of the ref path name, the initial "refs/" that this caller had already stripped off before calling lock_ref_sha1. Reviewed-by: Jonathan Nieder Sig

[PATCH v17 34/48] walker.c: use ref transaction for ref updates

2014-06-16 Thread Ronnie Sahlberg
Switch to using ref transactions in walker_fetch(). As part of the refactoring to use ref transactions we also fix a potential memory leak where in the original code if write_ref_sha1() would fail we would end up returning from the function without free()ing the msg string. Note that this function

Re: [PATCH RFC] git-am: support any number of signatures

2014-06-16 Thread Junio C Hamano
"Michael S. Tsirkin" writes: > Now A wants to sign this patch. > > I think there are two reasonable ways to behave: > 1. What you describe above: > A > B > A That is the only sensible thing to do for Signed-off-by footers. > 2. For things like Tested-by: tags, removing tag from > where it was a

[PATCH v17 35/48] refs.c: make lock_ref_sha1 static

2014-06-16 Thread Ronnie Sahlberg
No external callers reference lock_ref_sha1 any more so lets declare it static. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 2 +- refs.h | 6 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/refs.c b/refs.c index 50e5475..bb12e65 100644 --- a/ref

[PATCH v17 46/48] refs.c: propagate any errno==ENOTDIR from _commit back to the callers

2014-06-16 Thread Ronnie Sahlberg
In _commit, ENOTDIR can happen in the call to lock_ref_sha1_basic, either when we lstat the new refname and it returns ENOTDIR or if the name checking function reports that the same type of conflict happened. In both cases it means that we can not create the new ref due to a name conflict. For the

[PATCH v17 40/48] refs.c: make delete_ref use a transaction

2014-06-16 Thread Ronnie Sahlberg
Change delete_ref to use a ref transaction for the deletion. At the same time since we no longer have any callers of repack_without_ref we can now delete this function. Change delete_ref to return 0 on success and 1 on failure instead of the previous 0 on success either 1 or -1 on failure. Review

[PATCH v17 26/48] replace.c: use the ref transaction functions for updates

2014-06-16 Thread Ronnie Sahlberg
Update replace.c to use ref transactions for updates. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/replace.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/builtin/replace.c b/builtin/replace.c index b62420a..24f0dc9 100644 --- a/b

[PATCH v17 41/48] refs.c: pass the ref log message to _create/delete/update instead of _commit

2014-06-16 Thread Ronnie Sahlberg
Change the reference transactions so that we pass the reflog message through to the create/delete/update function instead of the commit message. This allows for individual messages for each change in a multi ref transaction. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- branch

[PATCH v17 44/48] refs.c: call lock_ref_sha1_basic directly from commit

2014-06-16 Thread Ronnie Sahlberg
Skip using the lock_any_ref_for_update wrapper and call lock_ref_sha1_basic directly from the commit function. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 69815d9..d

[PATCH v17 39/48] refs.c: make prune_ref use a transaction to delete the ref

2014-06-16 Thread Ronnie Sahlberg
Change prune_ref to delete the ref using a ref transaction. To do this we also need to add a new flag REF_ISPRUNING that will tell the transaction that we do not want to delete this ref from the packed refs. This flag is private to refs.c and not exposed to external callers. Reviewed-by: Jonathan

[PATCH v17 36/48] refs.c: remove the update_ref_lock function

2014-06-16 Thread Ronnie Sahlberg
Since we now only call update_ref_lock with onerr==QUIET_ON_ERR we no longer need this function and can replace it with just calling lock_any_ref_for_update directly. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 30 ++ 1 file changed, 6 in

[PATCH v17 27/48] commit.c: use ref transactions for updates

2014-06-16 Thread Ronnie Sahlberg
Change commit.c to use ref transactions for all ref updates. Make sure we pass a NULL pointer to ref_transaction_update if have_old is false. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/commit.c | 24 +++- 1 file changed, 11 insertions(+), 13 dele

[PATCH v17 47/48] fetch.c: change s_update_ref to use a ref transaction

2014-06-16 Thread Ronnie Sahlberg
Change s_update_ref to use a ref transaction for the ref update. Signed-off-by: Ronnie Sahlberg --- builtin/fetch.c | 33 +++-- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index faa1233..52f1ebc 100644 --- a/builti

  1   2   >