Re: [PATCH 2/2] update-ref: fix "verify" command with missing

2014-12-11 Thread Brad King
On 12/10/2014 6:47 PM, Michael Haggerty wrote: > set have_old unconditionally and set old_sha1 to null_sha1. Reviewed-by: Brad King -Brad -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo

Re: [PATCH 1/2] t1400: add some more tests of "update-ref --stdin"'s verify command

2014-12-11 Thread Brad King
On 12/10/2014 6:47 PM, Michael Haggerty wrote: > Two of the tests fail because > > verify refs/heads/foo > > with no argument (not even zeros) actually *deletes* refs/heads/foo. > This problem will be fixed in the next commit. Reviewed-by: Brad King -Brad -- To unsubscr

Re: [PATCH] update-ref: fail create operation over stdin if ref already exists

2014-04-02 Thread Brad King
On 04/02/2014 04:09 AM, Michael Haggerty wrote: > From: Aman Gupta [snip] > @@ -147,6 +147,7 @@ static void parse_cmd_create(const char *next) > struct ref_update *update; > > update = update_alloc(); > + update->have_old = 1; Looks good. > +test_expect_success 'stdin -z create

Re: [PATCH v2 19/27] refs: Add a concept of a reference transaction

2014-03-26 Thread Brad King
On 03/24/2014 01:56 PM, Michael Haggerty wrote: > +void ref_transaction_update(struct ref_transaction *transaction, > + const char *refname, > + unsigned char *new_sha1, unsigned char *old_sha1, > + int flags, int have_old); [s

Re: [PATCH v2 00/27] Clean up update-refs --stdin and implement ref_transaction

2014-03-26 Thread Brad King
On 03/24/2014 01:56 PM, Michael Haggerty wrote: > Changes relative to v1: > > * Rename the functions associated with ref_transactions to be more > reminiscent of database transactions: > > * create_ref_transaction() -> ref_transaction_begin() > * free_ref_transaction() -> ref_transaction_ro

Re: [PATCH v2 16/27] t1400: Test one mistake at a time

2014-03-26 Thread Brad King
On 03/24/2014 01:56 PM, Michael Haggerty wrote: > Signed-off-by: Michael Haggerty > > t1400: Add a test of "update" with too few arguments > > Signed-off-by: Michael Haggerty This looks like a stray squash message. -Brad -- To unsubscribe from this list: send the line "unsubscribe git" in th

Re: [PATCH v2 14/27] update-ref.c: Extract a new function, parse_next_sha1()

2014-03-26 Thread Brad King
On 03/24/2014 01:56 PM, Michael Haggerty wrote: > +/* > + * For backwards compatibility, accept an empty string for create's > + * in binary mode to be equivalent to specifying zeros. > + */ > +#define PARSE_SHA1_ALLOW_EMPTY 0x02 The comment should say "update's", not "create's". -Brad -- To un

Re: [PATCH 03/26] t1400: Pass a legitimate to update command

2014-03-11 Thread Brad King
On Tue, Mar 11, 2014 at 4:06 PM, Junio C Hamano wrote: > I may be misremembering things, but your first sentence quoted above > was exactly my reaction while reviewing the original change, and I > might have even raised that as an issue myself, saying something > like "consistency across values is

Re: [PATCH 03/26] t1400: Pass a legitimate to update command

2014-03-11 Thread Brad King
On 03/10/2014 05:38 PM, Michael Haggerty wrote: > It seems to me that "-z" input will nearly always be machine-generated, > so there is not much reason to accept the empty string as shorthand for > zeros. So I think that my version of the rules, being simpler to > explain, is a slight improvement.

Re: [PATCH 00/26] Clean up update-refs --stdin and implement ref_transaction

2014-03-10 Thread Brad King
Hi Michael, This is excellent work. I haven't reviewed every line of logic in detail but the changes look correct at a high level. The only exception is that the empty is supposed to be accepted and treated as zero even in "--stdin -z" mode. See my response to that individual change. On 03/10

Re: [PATCH 13/26] update-ref --stdin: Simplify error messages for missing oldvalues

2014-03-10 Thread Brad King
On 03/10/2014 08:46 AM, Michael Haggerty wrote: > Instead of, for example, > > fatal: update refs/heads/master missing [] NUL > > emit > > fatal: update refs/heads/master missing [snip] > - die("update %s missing [] NUL", update->ref_name); > + die("update %s mis

Re: [PATCH 13/26] update-ref --stdin: Simplify error messages for missing oldvalues

2014-03-10 Thread Brad King
On 03/10/2014 01:08 PM, Brad King wrote: >> -die("update %s missing [] NUL", update->ref_name); >> +die("update %s missing ", update->ref_name); > > The reason for the original wording is that the is indeed > optional.

Re: [PATCH 03/26] t1400: Pass a legitimate to update command

2014-03-10 Thread Brad King
On 03/10/2014 08:46 AM, Michael Haggerty wrote: > This test is trying to test a few ways to delete references using "git > update-ref -z --stdin". The third line passed in is > > update SP /refs/heads/c NUL NUL NUL > > , which is not a correct way to delete a reference according to the > do

[PATCH v3 1/4] t3030-merge-recursive: Test known breakage with empty work tree

2014-01-27 Thread Brad King
merge-base --all $ours $theirs) && git merge-recursive $bases -- $ours $theirs && tree=$(git write-tree) Nowadays, that still works and the exit status is the same, but merge-recursive produces a diagnostic if "our" side renamed a file: error: addinfo_ca

[PATCH v3 2/4] read-cache.c: Refactor --ignore-missing implementation

2014-01-27 Thread Brad King
Move lstat ENOENT handling from refresh_index to refresh_cache_ent and activate it with a new CE_MATCH_IGNORE_MISSING option. This will allow other call paths into refresh_cache_ent to use the feature. Signed-off-by: Brad King --- cache.h | 2 ++ read-cache.c | 8 +--- 2 files changed

[PATCH v3 4/4] merge-recursive.c: Tolerate missing files while refreshing index

2014-01-27 Thread Brad King
tree - ours has rename' case in t3030-merge-recursive. Suggested-by: Elijah Newren Signed-off-by: Brad King --- merge-recursive.c | 3 ++- t/t3030-merge-recursive.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/merge-recursive.c b/merge-recursive.c ind

[PATCH v3 3/4] read-cache.c: Extend make_cache_entry refresh flag with options

2014-01-27 Thread Brad King
Convert the make_cache_entry boolean 'refresh' argument to a more general 'refresh_options' argument. Pass the value through to the underlying refresh_cache_ent call. Add option CE_MATCH_REFRESH to enable stat refresh. Update call sites to use the new signature. Sign

[PATCH v3 0/3] merge-recursive: Avoid diagnostic on empty work tree

2014-01-27 Thread Brad King
option. * Rather than adding a new argument to make_cache_entry, the existing 'refresh' boolean argument has been generalized to a set of options. This required the addition of a new CE_MATCH_REFRESH option to enable refresh with no other options. Thanks, -Brad Brad King (4): t

[PATCH v2 2/3] read-cache.c: Optionally tolerate missing files in make_cache_entry

2014-01-24 Thread Brad King
Add an 'int refresh_flags' argument to make_cache_entry to tell the refresh step about caller preferences. Teach it to honor the REFRESH_IGNORE_MISSING flag to skip refreshing stat information when a file is missing from the work tree on disk. Signed-off-by: Brad King --- built

[PATCH v2 0/3] merge-recursive: Avoid diagnostic on empty work tree

2014-01-24 Thread Brad King
to make_cache_entry. This one is to request certain refresh behavior instead of just to get an error value back. * Patch 3 uses the new make_cache_entry feature in patch 2 to fix the test case. This approach is based on suggestions from Elijah and Junio. Thanks, -Brad Brad King (3

[PATCH v2 1/3] t3030-merge-recursive: Test known breakage with empty work tree

2014-01-24 Thread Brad King
merge-base --all $ours $theirs) && git merge-recursive $bases -- $ours $theirs && tree=$(git write-tree) Nowadays, that still works and the exit status is the same, but merge-recursive produces a diagnostic if "our" side renamed a file: error: addinfo_ca

[PATCH v2 3/3] merge-recursive.c: Tolerate missing files while refreshing index

2014-01-24 Thread Brad King
tree - ours has rename' case in t3030-merge-recursive. Suggested-by: Elijah Newren Signed-off-by: Brad King --- merge-recursive.c | 3 ++- t/t3030-merge-recursive.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/merge-recursive.c b/merge-recursive.c ind

Re: [PATCH/RFC 3/3] merge-recursive: Tolerate missing file when HEAD is up to date

2014-01-24 Thread Brad King
On Fri, Jan 24, 2014 at 2:50 PM, Junio C Hamano wrote: > It somehow feels wrong to force callers of make_cache_entry() to be > so intimate with the implementation details of refresh_cache_ent() [snip] > option bit CE_MATCH_MISSING_OK that asks it to treat a path that is > missing from the working

Re: [PATCH/RFC 3/3] merge-recursive: Tolerate missing file when HEAD is up to date

2014-01-24 Thread Brad King
On 01/24/2014 01:42 PM, Elijah Newren wrote: > While this change does work for the particular new testcase you provided, > there's a more complex case where merge-recursive is failing I'm not surprised. The change felt much like covering a symptom. > it's just that we want the stat information r

Re: [PATCH/RFC 1/3] t3030-merge-recursive: Test known breakage with empty work tree

2014-01-24 Thread Brad King
On 01/24/2014 11:51 AM, Jonathan Nieder wrote: > a quick summary of the symptoms and when it came up? You're suggested commit message correctly explains it: > Do you mean something like the following? > > Sometimes when working with a large repository it can be useful to > try out a

[PATCH/RFC 2/3] read-cache.c: Thread lstat error through make_cache_entry signature

2014-01-24 Thread Brad King
ng file on disk. Signed-off-by: Brad King --- builtin/apply.c| 2 +- builtin/checkout.c | 2 +- builtin/reset.c| 2 +- cache.h| 2 +- merge-recursive.c | 3 ++- read-cache.c | 12 +++- resolve-undo.c | 2 +- 7 files changed, 14 insertions(+), 11 deletion

[PATCH/RFC 3/3] merge-recursive: Tolerate missing file when HEAD is up to date

2014-01-24 Thread Brad King
-recursive. Signed-off-by: Brad King --- merge-recursive.c | 21 + t/t3030-merge-recursive.sh | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/merge-recursive.c b/merge-recursive.c index 4394c44..6a2b962 100644 --- a/merge-recursive.c +++ b/merge-r

[PATCH/RFC 0/3] merge-recursive: Avoid diagnostic on empty work tree

2014-01-24 Thread Brad King
m $gmane/240853. * Patch 2 extends the make_cache_entry signature to return lstat errno. * Patch 3 uses this information to silence the add_cacheinfo diagnostic -Brad Brad King (3): t3030-merge-recursive: Test known breakage with empty work tree read-cache.c: Thread lstat error through m

[PATCH/RFC 1/3] t3030-merge-recursive: Test known breakage with empty work tree

2014-01-24 Thread Brad King
rge appears to succeed, but it causes this test case to fail. Signed-off-by: Brad King --- t/t3030-merge-recursive.sh | 47 ++ 1 file changed, 47 insertions(+) diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index 2f96100..b6d3ed0

[PATCH] t3030-merge-recursive: Test known breakage with empty work tree

2014-01-22 Thread Brad King
rge appears to succeed, but it causes this test case to fail. Signed-off-by: Brad King --- t/t3030-merge-recursive.sh | 47 ++ 1 file changed, 47 insertions(+) diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index 2f96100..b6d3ed0

[PATCH v6.1 8/8] update-ref: add test cases covering --stdin signature

2013-09-11 Thread Brad King
Extend t/t1400-update-ref.sh to cover cases using the --stdin option. Signed-off-by: Brad King --- On 09/10/2013 06:46 PM, Eric Sunshine wrote: > Thus printf provides all the functionality you require, and > print_nul() function can be dropped. So: > > printf '%s\0'

Re: [PATCH v6 7/8] update-ref: support multiple simultaneous updates

2013-09-11 Thread Brad King
On 09/10/2013 06:51 PM, Eric Sunshine wrote: > On Mon, Sep 9, 2013 at 8:57 PM, Brad King wrote: >> +Use 40 "0" or the empty string to specify a zero value, except that > > Did you want an 's' after the "0"? The same description without 's

Re: [PATCH v6 0/8] Multiple simultaneously locked ref updates

2013-09-10 Thread Brad King
On 09/10/2013 12:30 PM, Junio C Hamano wrote: > Thanks. I am not sure if I should rewind and rebuild the series > with these patches, though. This is a new feature and does not have > to be merged to 'maint', so rebasing is perfectly fine, but it is > not strictly necessary, either. I just thoug

[PATCH v6 1/8] reset: rename update_refs to reset_refs

2013-09-09 Thread Brad King
The function resets refs rather than doing arbitrary updates. Rename it to allow a future general-purpose update_refs function to be added. Signed-off-by: Brad King --- builtin/reset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c

[PATCH v6 8/8] update-ref: add test cases covering --stdin signature

2013-09-09 Thread Brad King
Extend t/t1400-update-ref.sh to cover cases using the --stdin option. Signed-off-by: Brad King --- t/t1400-update-ref.sh | 639 ++ 1 file changed, 639 insertions(+) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index e415ee0..a510500

[PATCH v6 2/8] refs: report ref type from lock_any_ref_for_update

2013-09-09 Thread Brad King
Expose lock_ref_sha1_basic's type_p argument to callers of lock_any_ref_for_update. Update all call sites to ignore it by passing NULL for now. Signed-off-by: Brad King --- branch.c | 2 +- builtin/commit.c | 2 +- builtin/fetch.c| 3 ++- builtin/receive-pack.

[PATCH v6 5/8] refs: add function to repack without multiple refs

2013-09-09 Thread Brad King
Generalize repack_without_ref as repack_without_refs to support a list of refs and implement the former in terms of the latter. Signed-off-by: Brad King --- refs.c | 33 - 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/refs.c b/refs.c index

[PATCH v6 4/8] refs: factor delete_ref loose ref step into a helper

2013-09-09 Thread Brad King
Factor loose ref deletion into helper function delete_ref_loose to allow later use elsewhere. Signed-off-by: Brad King --- refs.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index f7d3c09..b14f59b 100644 --- a/refs.c +++ b

[PATCH v6 3/8] refs: factor update_ref steps into helpers

2013-09-09 Thread Brad King
is not necessary to keep across invocations. Signed-off-by: Brad King --- refs.c | 30 -- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 5832a8f..f7d3c09 100644 --- a/refs.c +++ b/refs.c @@ -3170,12 +3170,13 @@ int for_each_re

[PATCH v6 6/8] refs: add update_refs for multiple simultaneous updates

2013-09-09 Thread Brad King
original branch by a concurrent process, or risk of a concurrent process creating the new branch first. Signed-off-by: Brad King --- refs.c | 100 + refs.h | 20 + 2 files changed, 120 insertions(+) diff --git a/refs.c b/

[PATCH v6 7/8] update-ref: support multiple simultaneous updates

2013-09-09 Thread Brad King
Add a --stdin signature to read update instructions from standard input and apply multiple ref updates together. Use an input format that supports any update that could be specified via the command-line, including object names like "branch:path with space". Signed-off-by:

[PATCH v6 0/8] Multiple simultaneously locked ref updates

2013-09-09 Thread Brad King
(Replace deprecated OPT_BOOLEAN by OPT_BOOL, 2013-08-03) was resolved by integrating both changes. The new options added in patch 7 now use OPT_BOOL. -Brad Brad King (8): reset: rename update_refs to reset_refs refs: report ref type from lock_any_ref_for_update refs: factor update_ref

[PATCH v5 0/8] Multiple simultaneously locked ref updates

2013-09-09 Thread Brad King
series: * Patches 1-6 are identical to v4 so are not re-sent here. * Patch 7 and 8 now implement and test the input format proposed and discussed at $gmane/233990. -Brad Brad King (2): update-ref: support multiple simultaneous updates update-ref: add test cases covering --stdin signature

[PATCH v5 7/8] update-ref: support multiple simultaneous updates

2013-09-09 Thread Brad King
Add a --stdin signature to read update instructions from standard input and apply multiple ref updates together. Use an input format that supports any update that could be specified via the command-line, including object names like "branch:path with space". Signed-off-by:

[PATCH v5 8/8] update-ref: add test cases covering --stdin signature

2013-09-09 Thread Brad King
Extend t/t1400-update-ref.sh to cover cases using the --stdin option. Signed-off-by: Brad King --- t/t1400-update-ref.sh | 639 ++ 1 file changed, 639 insertions(+) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index e415ee0..a510500

Re: [PATCH v4 7/8] update-ref: support multiple simultaneous updates

2013-09-05 Thread Brad King
On 9/5/2013 5:23 PM, Junio C Hamano wrote: > Brad King writes: >> create SP NUL NUL >> update SP NUL NUL [] NUL > > That SP in '-z' format looks strange. Was there a reason why NUL > was inappropriate? The precedent I saw in the -z survey I poste

Re: [PATCH v4 7/8] update-ref: support multiple simultaneous updates

2013-09-05 Thread Brad King
On 09/04/2013 05:27 PM, Junio C Hamano wrote: > I am not saying the above is the best format, but the point is that > the mode of the operation defines the structure Great, thanks for your comments. Based on that I've prototyped a new format. Rather than jumping straight to the patch, here is my

Re: [PATCH v4 7/8] update-ref: support multiple simultaneous updates

2013-09-04 Thread Brad King
On 09/04/2013 02:23 PM, Junio C Hamano wrote: > "whitespace-separated" implies that we may allow fields separated with not a > single SP, but with double SPs or even HTs between them. I personally do not > think we should be so loose Okay, I will look at making it more strict. See proposed form

Re: [PATCH v4 7/8] update-ref: support multiple simultaneous updates

2013-09-04 Thread Brad King
On 09/04/2013 03:17 PM, Junio C Hamano wrote: > Brad King writes: >> +static void update_refs_stdin_read_n() >> +static void update_refs_stdin_read_z() > > These need to be defined with explicit (void) argument list. Oops, fixed. Thanks, -Brad -- To unsubscribe from thi

[PATCH v4 4/8] refs: factor delete_ref loose ref step into a helper

2013-09-04 Thread Brad King
Factor loose ref deletion into helper function delete_ref_loose to allow later use elsewhere. Signed-off-by: Brad King --- refs.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 4347826..ab9d22e 100644 --- a/refs.c +++ b

[PATCH v4 7/8] update-ref: support multiple simultaneous updates

2013-09-04 Thread Brad King
Add a --stdin signature to read update instructions from standard input and apply multiple ref updates together. Use an input format that supports any update that could be specified via the command-line, including object names like "branch:path with space". Signed-off-by:

[PATCH v4 1/8] reset: rename update_refs to reset_refs

2013-09-04 Thread Brad King
The function resets refs rather than doing arbitrary updates. Rename it to allow a future general-purpose update_refs function to be added. Signed-off-by: Brad King --- builtin/reset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c

[PATCH v4 2/8] refs: report ref type from lock_any_ref_for_update

2013-09-04 Thread Brad King
Expose lock_ref_sha1_basic's type_p argument to callers of lock_any_ref_for_update. Update all call sites to ignore it by passing NULL for now. Signed-off-by: Brad King --- branch.c | 2 +- builtin/commit.c | 2 +- builtin/fetch.c| 3 ++- builtin/receive-pack.

[PATCH v4 0/8] Multiple simultaneously locked ref updates

2013-09-04 Thread Brad King
in $gmane/233521 and made in v3 and kept in v4. Thanks, -Brad Brad King (8): reset: rename update_refs to reset_refs refs: report ref type from lock_any_ref_for_update refs: factor update_ref steps into helpers refs: factor delete_ref loose ref step into a helper refs: add function to rep

[PATCH v4 6/8] refs: add update_refs for multiple simultaneous updates

2013-09-04 Thread Brad King
original branch by a concurrent process, or risk of a concurrent process creating the new branch first. Signed-off-by: Brad King --- refs.c | 100 + refs.h | 20 + 2 files changed, 120 insertions(+) diff --git a/refs.c b/

[PATCH v4 8/8] update-ref: add test cases covering --stdin signature

2013-09-04 Thread Brad King
Extend t/t1400-update-ref.sh to cover cases using the --stdin option. Signed-off-by: Brad King --- t/t1400-update-ref.sh | 445 ++ 1 file changed, 445 insertions(+) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index e415ee0..e8ba0d2

[PATCH v4 5/8] refs: add function to repack without multiple refs

2013-09-04 Thread Brad King
Generalize repack_without_ref as repack_without_refs to support a list of refs and implement the former in terms of the latter. Signed-off-by: Brad King --- refs.c | 33 - 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/refs.c b/refs.c index

[PATCH v4 3/8] refs: factor update_ref steps into helpers

2013-09-04 Thread Brad King
is not necessary to keep across invocations. Signed-off-by: Brad King --- refs.c | 30 -- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index c69fd68..4347826 100644 --- a/refs.c +++ b/refs.c @@ -3170,12 +3170,13 @@ int for_each_re

Re: [PATCH v3 8/8] update-ref: add test cases covering --stdin signature

2013-09-03 Thread Brad King
On 09/03/2013 04:16 AM, Eric Sunshine wrote: > When you decomposed the monolithic test from v1 into individual tests, > you dropped a couple cases ("fatal: unknown option'" and "fatal: > unterminated single-quote"). Was this intentional? Yes. The v3 patch 7 changed the set of error messages to be

Re: [PATCH v2 6/8] refs: add update_refs for multiple simultaneous updates

2013-09-03 Thread Brad King
On 09/03/2013 12:43 AM, Michael Haggerty wrote: > Hmmm, I see that you changed the signature of update_refs() to take an > array of pointers. My suggestion was unclear, but I didn't mean that > the function signature had to be changed. [snip] > However, your approach is also fine. Okay. Thanks f

Re: [PATCH v3 7/8] update-ref: support multiple simultaneous updates

2013-09-02 Thread Brad King
On 09/02/2013 01:48 PM, Brad King wrote: > + /* Parse the argument: */ > + strbuf_reset(arg); > + if (*next == '"') { > + if (unquote_c_style(arg, next, &next)) > + die("badly quoted argument:

[PATCH v3 0/8] Multiple simultaneously locked ref updates

2013-09-02 Thread Brad King
ref name * In patch 7, another new input format is proposed. It now uses quoting based on unquote_c_style. * In patch 8, more new test cases have been added. Failure cases are now covered in separate steps to simplify diagnosis. -Brad Brad King (8): reset: rename update_refs to reset_ref

[PATCH v3 7/8] update-ref: support multiple simultaneous updates

2013-09-02 Thread Brad King
Add a --stdin signature to read update instructions from standard input and apply multiple ref updates together. Use an input format that supports any update that could be specified via the command-line, including object names like "branch:path with space". Signed-off-by:

[PATCH v3 2/8] refs: report ref type from lock_any_ref_for_update

2013-09-02 Thread Brad King
Expose lock_ref_sha1_basic's type_p argument to callers of lock_any_ref_for_update. Update all call sites to ignore it by passing NULL for now. Signed-off-by: Brad King --- branch.c |2 +- builtin/commit.c |2 +- builtin/fetch.c|3 ++- builtin/re

[PATCH v3 3/8] refs: factor update_ref steps into helpers

2013-09-02 Thread Brad King
is not necessary to keep across invocations. Signed-off-by: Brad King --- refs.c | 30 -- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index c69fd68..4347826 100644 --- a/refs.c +++ b/refs.c @@ -3170,12 +3170,13 @@ int for_each_re

[PATCH v3 5/8] refs: add function to repack without multiple refs

2013-09-02 Thread Brad King
Generalize repack_without_ref as repack_without_refs to support a list of refs and implement the former in terms of the latter. Signed-off-by: Brad King --- refs.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index ab9d22e

[PATCH v3 6/8] refs: add update_refs for multiple simultaneous updates

2013-09-02 Thread Brad King
original branch by a concurrent process, or risk of a concurrent process creating the new branch first. Signed-off-by: Brad King --- refs.c | 100 refs.h | 20 + 2 files changed, 120 insertions(+) diff --git a/refs.c b/

[PATCH v3 1/8] reset: rename update_refs to reset_refs

2013-09-02 Thread Brad King
The function resets refs rather than doing arbitrary updates. Rename it to allow a future general-purpose update_refs function to be added. Signed-off-by: Brad King --- builtin/reset.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c

[PATCH v3 8/8] update-ref: add test cases covering --stdin signature

2013-09-02 Thread Brad King
Extend t/t1400-update-ref.sh to cover cases using the --stdin option. Signed-off-by: Brad King --- t/t1400-update-ref.sh | 256 + 1 file changed, 256 insertions(+) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index e415ee0..b6d7dfa

[PATCH v3 4/8] refs: factor delete_ref loose ref step into a helper

2013-09-02 Thread Brad King
Factor loose ref deletion into helper function delete_ref_loose to allow later use elsewhere. Signed-off-by: Brad King --- refs.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 4347826..ab9d22e 100644 --- a/refs.c +++ b

Re: [PATCH v2 8/8] update-ref: add test cases covering --stdin signature

2013-09-02 Thread Brad King
On 08/31/2013 11:41 PM, Eric Sunshine wrote: >> + rm -f stdin && >> + touch stdin && > > Unless the timestamp of 'stdin' has particular significance, modern > git tests avoid 'touch' in favor of creating the empty file like this > > >stdin && Fixed. >> + git update-ref --s

Re: [PATCH v2 7/8] update-ref: support multiple simultaneous updates

2013-09-02 Thread Brad King
On 08/30/2013 06:51 PM, Junio C Hamano wrote: > Brad King writes: >> +With `--stdin`, update-ref reads instructions from standard input and >> +performs all modifications together. Empty lines are ignored. >> +Each non-empty line is parsed as whitespace-separated arguments.

Re: [PATCH v2 7/8] update-ref: support multiple simultaneous updates

2013-09-02 Thread Brad King
On 08/31/2013 02:42 PM, Michael Haggerty wrote: > On 08/30/2013 08:12 PM, Brad King wrote: >> +If all s can be locked with matching s >> +simultaneously all modifications are performed. Otherwise, no > > Comma after "simultaneously". Fixed. > I agree with

Re: [PATCH v2 6/8] refs: add update_refs for multiple simultaneous updates

2013-09-02 Thread Brad King
On 08/31/2013 02:19 PM, Michael Haggerty wrote: > s/themeselves/themselves/ Fixed. >> +struct ref_update *u1 = (struct ref_update *)(r1); >> +struct ref_update *u2 = (struct ref_update *)(r2); > > If you declare u1 and u2 to be "const struct ref_update *" (i.e., add > "const"), then you

Re: [PATCH v2 6/8] refs: add update_refs for multiple simultaneous updates

2013-09-02 Thread Brad King
On 09/01/2013 02:08 AM, Junio C Hamano wrote: >> Though the refs themeselves cannot be modified together in a single > > "themselves". Fixed. > I notice that we are using an array of structures and letting qsort > swap 50~64 bytes of data Michael suggested this too, so fixed. > Optionally we c

Re: [PATCH v2 3/8] refs: factor update_ref steps into helpers

2013-09-02 Thread Brad King
On 09/01/2013 02:08 AM, Junio C Hamano wrote: > Brad King writes: >> static struct ref_lock *lock; > > Not the fault of this patch, as the original update_ref() had it > this way, but it is not necessary to keep the value of this variable > across invocations. Let'

Re: [PATCH v2 4/8] refs: factor delete_ref loose ref step into a helper

2013-09-02 Thread Brad King
On 08/31/2013 12:30 PM, Michael Haggerty wrote: > Given that ret is only returned, you could restore the filename before > the if statement and replace the ret variable with an immediate return > statement: Good idea. Fixed in next revision. Thanks, -Brad -- To unsubscribe from this list: send t

[PATCH v2 7/8] update-ref: support multiple simultaneous updates

2013-08-30 Thread Brad King
Add a --stdin signature to read update instructions from standard input and apply multiple ref updates together. Use an input format that supports any update that could be specified via the command-line, including object names like 'branch:path with space'. Signed-off-by:

[PATCH v2 6/8] refs: add update_refs for multiple simultaneous updates

2013-08-30 Thread Brad King
original branch by a concurrent process, or risk of a concurrent process creating the new branch first. Signed-off-by: Brad King --- refs.c | 121 refs.h | 14 2 files changed, 135 insertions(+) diff --git a/refs.c b/refs.c in

[PATCH v2 5/8] refs: add function to repack without multiple refs

2013-08-30 Thread Brad King
Generalize repack_without_ref as repack_without_refs to support a list of refs and implement the former in terms of the latter. Signed-off-by: Brad King --- refs.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index 5dd86ee

[PATCH v2 2/8] refs: report ref type from lock_any_ref_for_update

2013-08-30 Thread Brad King
Expose lock_ref_sha1_basic's type_p argument to callers of lock_any_ref_for_update. Update all call sites to ignore it by passing NULL for now. Signed-off-by: Brad King --- branch.c |2 +- builtin/commit.c |2 +- builtin/fetch.c|3 ++- builtin/re

[PATCH v2 3/8] refs: factor update_ref steps into helpers

2013-08-30 Thread Brad King
Factor the lock and write steps and error handling into helper functions update_ref_lock and update_ref_write to allow later use elsewhere. Expose lock_any_ref_for_update's type_p to update_ref_lock callers. Signed-off-by: Brad King --- refs.c | 28 +++- 1 file ch

[PATCH v2 8/8] update-ref: add test cases covering --stdin signature

2013-08-30 Thread Brad King
Extend t/t1400-update-ref.sh to cover cases using the --stdin option. Signed-off-by: Brad King --- t/t1400-update-ref.sh | 206 + 1 file changed, 206 insertions(+) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index e415ee0..9fd03fc

[PATCH v2 4/8] refs: factor delete_ref loose ref step into a helper

2013-08-30 Thread Brad King
Factor loose ref deletion into helper function delete_ref_loose to allow later use elsewhere. Signed-off-by: Brad King --- refs.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index 2e755b4..5dd86ee 100644 --- a/refs.c +++ b/refs.c

[PATCH v2 1/8] reset: rename update_refs to reset_refs

2013-08-30 Thread Brad King
The function resets refs rather than doing arbitrary updates. Rename it to allow a future general-purpose update_refs function to be added. Signed-off-by: Brad King --- builtin/reset.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c

[PATCH v2 0/8] Multiple simultaneously locked ref updates

2013-08-30 Thread Brad King
cases. -Brad Brad King (8): reset: rename update_refs to reset_refs refs: report ref type from lock_any_ref_for_update refs: factor update_ref steps into helpers refs: factor delete_ref loose ref step into a helper refs: add function to repack without multiple refs refs: add update_refs

Re: [PATCH/RFC 6/7] refs: add update_refs for multiple simultaneous updates

2013-08-29 Thread Brad King
On 08/29/2013 02:20 PM, Brad King wrote: > I wasn't happy with the asymmetry either but forgot to raise it in > the cover letter. We need a way to represent "old value not given" > as different from "old value is_null_sha1". [snip] > Another approach i

Re: [PATCH/RFC 7/7] update-ref: support multiple simultaneous updates

2013-08-29 Thread Brad King
On 08/29/2013 02:34 PM, Junio C Hamano wrote: > Brad King writes: > >> +const char *c, *s, *oldvalue, *value[2] = {0,0}; > > This patch has many style issues of the same kind, lack of a SP at > places where there should be between operators and after comma. Okay, I ca

Re: [PATCH/RFC 6/7] refs: add update_refs for multiple simultaneous updates

2013-08-29 Thread Brad King
On 08/29/2013 02:32 PM, Junio C Hamano wrote: > But it may not be a bad idea to keep the callers dumb and have this > function always sort, dedup, *and* fail inconsistent request. I agree. I was just starting to write the comment for update_refs and it basically would have said "always use ref_up

Re: [PATCH/RFC 0/7] Multiple simultaneously locked ref updates

2013-08-29 Thread Brad King
On 08/29/2013 02:07 PM, Junio C Hamano wrote: > I didn't mean to force the caller of new "update-ref --stdin"; the > new code you wrote for it is what feeds the input to update_refs() > function, and that is one place you can make sure you do not lock > yourself out. > > Besides, if you get two up

Re: [PATCH/RFC 6/7] refs: add update_refs for multiple simultaneous updates

2013-08-29 Thread Brad King
On 08/29/2013 01:39 PM, Junio C Hamano wrote: > Brad King writes: >> +for (i=0; i < n; ++i) { > > Style: > > for (i = 0; i < n; i++) { Fixed. > Is it asking for AB-BA deadlock? If so, is the caller responsible > for avoiding it? Since we don'

Re: [PATCH/RFC 5/7] refs: add function to repack without multiple refs

2013-08-29 Thread Brad King
On 08/29/2013 01:34 PM, Junio C Hamano wrote: > Brad King writes: >> +if(i == n) > > Style: > if (i == n) Fixed in next revision. -Brad -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org

Re: [PATCH/RFC 4/7] refs: factor delete_ref loose ref step into a helper

2013-08-29 Thread Brad King
On 08/29/2013 01:28 PM, Junio C Hamano wrote: > Brad King writes: >> -if (!(flag & REF_ISPACKED) || flag & REF_ISSYMREF) { >> +if (!(type & REF_ISPACKED) || type & REF_ISSYMREF) { > > Hits from "git grep REF_IS" tell me that all users of

Re: [PATCH/RFC 2/7] refs: report ref type from lock_any_ref_for_update

2013-08-29 Thread Brad King
On 08/29/2013 01:22 PM, Junio C Hamano wrote: > If you are passing an NULL as a new parameter, please spell it > "NULL", not "0". Fixed at all updated call sites. -Brad -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More maj

Re: [PATCH/RFC 1/7] reset: rename update_refs to reset_refs

2013-08-29 Thread Brad King
On 08/29/2013 01:17 PM, Junio C Hamano wrote: > Brad King writes: > >> Get it out of the way for a future refs.h function. > > Readers do not know if "update_refs()" is a good name for that > future refs.h function at this point, so "evict squatter" is

Re: [PATCH/RFC 0/7] Multiple simultaneously locked ref updates

2013-08-29 Thread Brad King
On 08/29/2013 12:21 PM, Junio C Hamano wrote: > Brad King writes: >> needs to reject duplicate ref names from the stdin lines before >> trying to lock the ref twice to avoid this message. > > How about trying not to feed duplicates? Sure, perhaps it is simplest to push the

Re: [PATCH/RFC 0/7] Multiple simultaneously locked ref updates

2013-08-29 Thread Brad King
On 08/29/2013 11:32 AM, Martin Fick wrote: > On Thursday, August 29, 2013 08:11:48 am Brad King wrote: >> >>fatal: Unable to create 'lock': File exists. >>If no other git process is currently running, this >> probably means a git process crashed in

[PATCH/RFC 0/7] Multiple simultaneously locked ref updates

2013-08-29 Thread Brad King
oach, interface, and implementation. Thanks, -Brad Brad King (7): reset: rename update_refs to reset_refs refs: report ref type from lock_any_ref_for_update refs: factor update_ref steps into helpers refs: factor delete_ref loose ref step into a helper refs: add function to repack without multi

[PATCH/RFC 3/7] refs: factor update_ref steps into helpers

2013-08-29 Thread Brad King
Factor the lock and write steps and error handling into helper functions update_ref_lock and update_ref_write to allow later use elsewhere. Expose lock_any_ref_for_update's type_p to update_ref_lock callers. Signed-off-by: Brad King --- refs.c | 28 +++- 1 file ch

[PATCH/RFC 2/7] refs: report ref type from lock_any_ref_for_update

2013-08-29 Thread Brad King
Expose lock_ref_sha1_basic's type_p argument to callers of lock_any_ref_for_update. Update all call sites to ignore it; we will use it later. Signed-off-by: Brad King --- branch.c |2 +- builtin/commit.c |2 +- builtin/fetch.c|2 +- builtin/re

  1   2   >