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

2014-01-22 Thread Brad King
. Signed-off-by: Brad King brad.k...@kitware.com --- 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 100755 --- a/t/t3030-merge-recursive.sh

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

2014-01-24 Thread Brad King
. Signed-off-by: Brad King brad.k...@kitware.com --- 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 100755 --- a/t/t3030-merge-recursive.sh

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

2014-01-24 Thread Brad King
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 make_cache_entry signature merge

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

2014-01-24 Thread Brad King
. Signed-off-by: Brad King brad.k...@kitware.com --- 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

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

2014-01-24 Thread Brad King
on disk. Signed-off-by: Brad King brad.k...@kitware.com --- 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

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

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

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 gits...@pobox.com 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

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

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

[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 brad.k...@kitware.com

[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
) 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_cache failed for path 'dst' Add a test to document this regression. Signed-off-by: Brad King brad.k...@kitware.com --- t/t3030-merge

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

2014-01-27 Thread Brad King
) 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_cache failed for path 'dst' Add a test to document this regression. Signed-off-by: Brad King brad.k...@kitware.com --- t/t3030-merge

[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): t3030-merge

[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 brad.k...@kitware.com --- cache.h | 2 ++ read-cache.c | 8

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

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

[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. Signed-off-by: Brad King brad.k

Re: [PATCH 03/26] t1400: Pass a legitimate newvalue 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 sha1 NUL , which is not a correct way to delete a reference according to the

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 [oldvalue] NUL, update-ref_name); +die(update %s missing oldvalue, update-ref_name); The reason for the original wording is that the oldvalue is indeed optional. This can only occur at end-of-input

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 [oldvalue] NUL emit fatal: update refs/heads/master missing oldvalue [snip] - die(update %s missing [oldvalue] NUL, update-ref_name); +

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 newvalue is supposed to be accepted and treated as zero even in --stdin -z mode. See my response to that individual change.

Re: [PATCH 03/26] t1400: Pass a legitimate newvalue 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. I

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

2014-03-11 Thread Brad King
On Tue, Mar 11, 2014 at 4:06 PM, Junio C Hamano gits...@pobox.com 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

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 + * newvalue 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

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 mhag...@alum.mit.edu t1400: Add a test of update with too few arguments Signed-off-by: Michael Haggerty mhag...@alum.mit.edu This looks like a stray squash message. -Brad -- To unsubscribe from this list:

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_rollback()

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);

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 a...@tmm1.net [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

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

2013-08-29 Thread Brad King
Add a --stdin signature to read update instructions from standard input and apply multiple ref updates and deletes together. Signed-off-by: Brad King brad.k...@kitware.com --- Documentation/git-update-ref.txt | 19 +++- builtin/update-ref.c | 93

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

2013-08-29 Thread Brad King
of another branch and rewind the original branch at the same time. This transfers ownership of commits between branches without risk of losing commits added to the original branch by a concurrent process, or risk of a concurrent process creating the new branch first. Signed-off-by: Brad King brad.k

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

2013-08-29 Thread Brad King
Get it out of the way for a future refs.h function. Signed-off-by: Brad King brad.k...@kitware.com --- builtin/reset.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index afa6e02..789ee48 100644 --- a/builtin/reset.c +++ b/builtin

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

2013-08-29 Thread Brad King
Factor loose ref deletion into helper function delete_ref_loose to allow later use elsewhere. While at it, rename local names 'flag = type' and 'delopt = flags' for consistency with callers and called functions. Signed-off-by: Brad King brad.k...@kitware.com --- refs.c | 24

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

2013-08-29 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 brad.k...@kitware.com --- refs.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/refs.c b

[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 brad.k...@kitware.com --- branch.c |2 +- builtin/commit.c |2 +- builtin/fetch.c|2

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

2013-08-29 Thread Brad King
, 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 multiple refs refs: add

[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 brad.k...@kitware.com --- refs.c | 28

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 this repository earlier. Make sure no other

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 brad.k...@kitware.com 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

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 brad.k...@kitware.com 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 not a very good justification

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 majordomo

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 brad.k...@kitware.com 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 REF_IS* symbol that check if a bit

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 brad.k...@kitware.com 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 More majordomo

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 brad.k...@kitware.com 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't actually block waiting

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 updates

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

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 brad.k...@kitware.com 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 can fix

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 is to add a dedicated member to struct ref_update

[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

[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 brad.k...@kitware.com --- builtin/reset.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin

[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 brad.k...@kitware.com --- 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

[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 brad.k...@kitware.com --- refs.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index 2e755b4..5dd86ee 100644

[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 brad.k...@kitware.com --- refs.c | 28

[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 brad.k...@kitware.com --- branch.c |2 +- builtin/commit.c |2 +- builtin/fetch.c|3

[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 brad.k...@kitware.com --- refs.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/refs.c b

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

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

[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: Brad King brad.k

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 brad.k...@kitware.com 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's drop

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 the

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 have const

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 could

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 refs can be locked with matching oldvalues +simultaneously all modifications are performed. Otherwise, no Comma after simultaneously. Fixed. I agree with Junio that your quoting rules

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 brad.k...@kitware.com 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. +Use

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 --stdin stdin

[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 brad.k...@kitware.com --- builtin/reset.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin

[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 brad.k...@kitware.com --- 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

[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 brad.k...@kitware.com --- refs.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 4347826..ab9d22e

[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 brad.k...@kitware.com --- refs.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/refs.c b

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

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

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

2013-09-02 Thread Brad King
, 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_refs refs: report ref type

[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: Brad King brad.k

[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 brad.k...@kitware.com --- branch.c |2 +- builtin/commit.c |2 +- builtin/fetch.c|3

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

2013-09-02 Thread Brad King
across invocations. Signed-off-by: Brad King brad.k...@kitware.com --- 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_reflog

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: %s, next); + return next; + } + while (*next

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 for

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

[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 brad.k...@kitware.com --- 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

[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 brad.k...@kitware.com --- refs.c | 33 - 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/refs.c

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

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

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

2013-09-04 Thread Brad King
across invocations. Signed-off-by: Brad King brad.k...@kitware.com --- 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_reflog

[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: Brad King brad.k

[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 brad.k...@kitware.com --- builtin/reset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/reset.c b

[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 repack

[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 brad.k...@kitware.com --- branch.c | 2 +- builtin/commit.c | 2 +- builtin/fetch.c| 3

[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 brad.k...@kitware.com --- refs.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 4347826..ab9d22e 100644

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 brad.k...@kitware.com 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 this list

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 format

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-05 Thread Brad King
On 9/5/2013 5:23 PM, Junio C Hamano wrote: Brad King brad.k...@kitware.com writes: create SP ref NUL newvalue NUL update SP ref NUL newvalue NUL [oldvalue] NUL That SP in '-z' format looks strange. Was there a reason why NUL was inappropriate? The precedent I saw in the -z

[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 brad.k...@kitware.com --- 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

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

2013-09-09 Thread Brad King
of the 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: Brad King brad.k

[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 v6 6/8] refs: add update_refs for multiple simultaneous updates

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

[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: Brad King brad.k

[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 brad.k...@kitware.com --- refs.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index f7d3c09..b14f59b 100644

[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 brad.k...@kitware.com --- branch.c | 2 +- builtin/commit.c | 2 +- builtin/fetch.c| 3

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

2013-09-09 Thread Brad King
across invocations. Signed-off-by: Brad King brad.k...@kitware.com --- 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_reflog

[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 brad.k...@kitware.com --- refs.c | 33 - 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/refs.c

[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 brad.k...@kitware.com --- builtin/reset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/reset.c b

[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 brad.k...@kitware.com --- 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

  1   2   >