Re: [PATCH v8 32/44] refs.c: remove the update_ref_write function

2014-05-22 Thread Ronnie Sahlberg
On Wed, May 21, 2014 at 3:07 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: +++ b/refs.c [...] @@ -3518,14 +3499,16 @@ int ref_transaction_commit(struct ref_transaction *transaction, struct ref_update *update = updates[i

Re: [PATCH v8 34/44] refs.c: make prune_ref use a transaction to delete the ref

2014-05-22 Thread Ronnie Sahlberg
Added a comment that any flags =0x100 are reserved for internal use. On Wed, May 21, 2014 at 4:01 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: Change prune_ref to delete the ref using a ref transaction. To do this we also need to add a new flag REF_ISPRUNING

Re: [PATCH v8 30/44] refs.c: add transaction.status and track OPEN/CLOSED/ERROR

2014-05-22 Thread Ronnie Sahlberg
On Wed, May 21, 2014 at 3:22 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: Please pull my ref-transactions branch. I'm at bd5736cb (2014-05-21 13:46) now. On Wed, May 21, 2014 at 3:00 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: --- a/refs.c

Re: [PATCH v8 39/44] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-05-22 Thread Ronnie Sahlberg
On Wed, May 21, 2014 at 6:42 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: --- a/refs.c +++ b/refs.c @@ -2044,6 +2044,9 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname, int missing = 0; int attempts_remaining = 3

Re: [PATCH v8 39/44] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-05-22 Thread Ronnie Sahlberg
On Thu, May 22, 2014 at 10:44 AM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: On Wed, May 21, 2014 at 6:42 PM, Jonathan Nieder jrnie...@gmail.com wrote: $ git rev-parse HEAD .git/refs/heads/foo..bar $ git branch -m foo..bar something-saner fatal

Re: [PATCH v8 38/44] refs.c: pack all refs before we start to rename a ref

2014-05-22 Thread Ronnie Sahlberg
On Thu, May 22, 2014 at 10:51 AM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: On Wed, May 21, 2014 at 4:57 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: This means that most loose refs will no longer be present after the rename Is this to handle

Re: [PATCH v8 41/44] refs.c: add a new flag for transaction delete for refs we know are packed only

2014-05-22 Thread Ronnie Sahlberg
On Thu, May 22, 2014 at 11:17 AM, Jonathan Nieder jrnie...@gmail.com wrote: Hi, Ronnie Sahlberg wrote: Add a new flag REF_ISPACKONLY that we can use in ref_transaction_delete. This flag indicates that the ref does not exist as a loose ref andf only as a packed ref. If this is the case we

Re: [PATCH v8 41/44] refs.c: add a new flag for transaction delete for refs we know are packed only

2014-05-22 Thread Ronnie Sahlberg
rename_ref becoming reasonably implementation agnostic, aside for that it wants to lstat the ref to see if it is a soft link, and re-use the code for other refs backends. Please see the ref-transaction branch. On Thu, May 22, 2014 at 12:12 PM, Ronnie Sahlberg sahlb...@google.com wrote: On Thu, May

Re: [PATCH v8 41/44] refs.c: add a new flag for transaction delete for refs we know are packed only

2014-05-23 Thread Ronnie Sahlberg
On Thu, May 22, 2014 at 4:53 PM, Jonathan Nieder jrnie...@gmail.com wrote: Jonathan Nieder wrote: Ronnie Sahlberg wrote: I hate rename_ref :-) I have reworked the transaction code to special case the deletion of the old ref for n/n - n and n - n/n renames so that we can carefully avoid n

Re: [PATCH v10 25/44] receive-pack.c: use a reference transaction for updating the refs

2014-05-23 Thread Ronnie Sahlberg
On Fri, May 23, 2014 at 6:49 AM, Michael Haggerty mhag...@alum.mit.edu wrote: On 05/19/2014 09:02 PM, Ronnie Sahlberg wrote: On Sat, May 17, 2014 at 8:35 AM, Michael Haggerty mhag...@alum.mit.edu wrote: On 05/16/2014 07:37 PM, Ronnie Sahlberg wrote: Wrap all the ref updates inside

Re: [PATCH v8 42/44] refs.c: pass a skip list to name_conflict_fn

2014-05-27 Thread Ronnie Sahlberg
On Thu, May 22, 2014 at 12:27 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: --- a/refs.c +++ b/refs.c @@ -798,11 +798,19 @@ struct name_conflict_cb { const char *refname; const char *oldrefname; const char *conflicting_refname; + const char

Re: [PATCH v8 00/44] Use ref transactions for all ref updates

2014-05-27 Thread Ronnie Sahlberg
On Thu, May 22, 2014 at 4:08 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: This patch series can also be found at https://github.com/rsahlberg/git/tree/ref-transactions Continuing with the review of 65a1cb7b (2014-05-22 12:08): 11/40 change ref_transaction_update

Re: [PATCH v10 22/44] fetch.c: clear errno before calling functions that might set it

2014-05-27 Thread Ronnie Sahlberg
On Sat, May 17, 2014 at 7:56 AM, Michael Haggerty mhag...@alum.mit.edu wrote: On 05/16/2014 07:37 PM, Ronnie Sahlberg wrote: In s_update_ref there are two calls that when they fail we return an error based on the errno value. In particular we want to return a specific error if ENOTDIR happened

Re: [PATCH v10 04/44] refs.c: add an err argument to repack_without_refs

2014-05-27 Thread Ronnie Sahlberg
On Sat, May 17, 2014 at 5:40 AM, Michael Haggerty mhag...@alum.mit.edu wrote: On 05/16/2014 07:36 PM, Ronnie Sahlberg wrote: 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

Re: [PATCH v10 25/44] receive-pack.c: use a reference transaction for updating the refs

2014-05-27 Thread Ronnie Sahlberg
On Fri, May 23, 2014 at 2:02 PM, Michael Haggerty mhag...@alum.mit.edu wrote: On 05/23/2014 06:14 PM, Ronnie Sahlberg wrote: On Fri, May 23, 2014 at 6:49 AM, Michael Haggerty mhag...@alum.mit.edu wrote: [...] When I combine these two lines of thought, it suggests to me that we could do

[PATCH v11 00/41] Use ref transactions

2014-05-27 Thread Ronnie Sahlberg
reflogs but all that will go in a different patch series. Version 11: - Updates after JNs review of the series. Ronnie Sahlberg (41): refs.c: remove ref_transaction_rollback refs.c: ref_transaction_commit should not free the transaction refs.c: constify the sha arguments

[PATCH v11 34/41] refs.c: pass NULL as *flags to read_ref_full

2014-05-27 Thread Ronnie Sahlberg
We call read_ref_full with a pointer to flags from rename_ref but since we never actually use the returned flags we can just pass NULL here instead. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 2 +- 1 file changed, 1 insertion

[PATCH v11 02/41] refs.c: ref_transaction_commit should not free the transaction

2014-05-27 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- 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/builtin

[PATCH v11 29/41] refs.c: remove the update_ref_write function

2014-05-27 Thread Ronnie Sahlberg
to start returning more detailed error conditions than the current simple success/failure. For example if the commit failed due to name conflicts etc. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 35 +-- 1 file changed, 9 insertions(+), 26

[PATCH v11 04/41] refs.c: allow passing NULL to ref_transaction_free

2014-05-27 Thread Ronnie Sahlberg
. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/refs.c b/refs.c index a767ef6..0faed29 100644 --- a/refs.c +++ b/refs.c @@ -3312,6 +3312,9 @@ void ref_transaction_free(struct

[PATCH v11 08/41] refs.c: add an err argument to delete_ref_loose

2014-05-27 Thread Ronnie Sahlberg
unlink_or_err that we can call from delete_ref_loose. This function is similar to unlink_or_warn except that we can pass it an err argument. If err is non-NULL the function will populate err instead of printing a warning(). Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 39

[PATCH v11 37/41] refs.c: call lock_ref_sha1_basic directly from commit

2014-05-27 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff

[PATCH v11 23/41] refs.c: change update_ref to use a transaction

2014-05-27 Thread Ronnie Sahlberg
Change the update_ref helper function to use a ref transaction internally. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index 9992da4..fd8f3cf 100644 --- a/refs.c +++ b

[PATCH v11 20/41] sequencer.c: use ref transactions for all ref updates

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

[PATCH v11 16/41] refs.c: add transaction.status and track OPEN/CLOSED/ERROR

2014-05-27 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 sahlb...@google.com --- refs.c | 42

[PATCH v11 25/41] fast-import.c: use a ref transaction when dumping tags

2014-05-27 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- fast-import.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/fast-import.c b/fast-import.c index 4a7b196..3db5b3d 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1735,15 +1735,22 @@ static void

[PATCH v11 40/41] fetch.c: change s_update_ref to use a ref transaction

2014-05-27 Thread Ronnie Sahlberg
Change s_update_ref to use a ref transaction for the ref update. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/fetch.c | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index faa1233..c46ccd9 100644

[PATCH v11 14/41] refs.c: update ref_transaction_delete to check for error and return status

2014-05-27 Thread Ronnie Sahlberg
that will be updated on failure. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 5 +++-- refs.c | 16 +++- refs.h | 12 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/builtin/update-ref.c b/builtin/update-ref.c

[PATCH v11 09/41] refs.c: make update_ref_write update a strbuf on failure

2014-05-27 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb

[PATCH v11 01/41] refs.c: remove ref_transaction_rollback

2014-05-27 Thread Ronnie Sahlberg
...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 7 +-- refs.h | 16 +++- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/refs.c b/refs.c index 6898263..48573e3 100644 --- a/refs.c +++ b/refs.c @@ -3308,7 +3308,7 @@ struct ref_transaction

[PATCH v11 11/41] refs.c: remove the onerr argument to ref_transaction_commit

2014-05-27 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 3

[PATCH v11 24/41] receive-pack.c: use a reference transaction for updating the refs

2014-05-27 Thread Ronnie Sahlberg
Wrap all the ref updates inside a transaction. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/receive-pack.c | 43 ++- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index

[PATCH v11 28/41] refs.c: remove the update_ref_lock function

2014-05-27 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 30

[PATCH v11 27/41] refs.c: make lock_ref_sha1 static

2014-05-27 Thread Ronnie Sahlberg
No external callers reference lock_ref_sha1 any more so lets declare it static. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 2 +- refs.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/refs.c b/refs.c

[PATCH v11 36/41] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-05-27 Thread Ronnie Sahlberg
caller and we will soon make changes to the signature to lock_ref_sha1_basic that we do not want to expose to that caller. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index 08dde5b..2952871

[PATCH v11 39/41] refs.c: propagate any errno==ENOTDIR from _commit back to the callers

2014-05-27 Thread Ronnie Sahlberg
directly. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 23 --- refs.h | 4 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index d3812b7..c108007 100644 --- a/refs.c +++ b/refs.c @@ -3517,7 +3517,7 @@ static int

[PATCH v11 17/41] tag.c: use ref transactions when doing updates

2014-05-27 Thread Ronnie Sahlberg
Change tag.c to use ref transactions for all ref updates. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/tag.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/builtin/tag.c b/builtin/tag.c index

[PATCH v11 18/41] replace.c: use the ref transaction functions for updates

2014-05-27 Thread Ronnie Sahlberg
Update replace.c to use ref transactions for updates. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/replace.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/builtin/replace.c b/builtin/replace.c

[PATCH v11 32/41] refs.c: make delete_ref use a transaction

2014-05-27 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. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 34 +- 1 file changed, 13

[PATCH v11 12/41] refs.c: change ref_transaction_update() to do error checking and return status

2014-05-27 Thread Ronnie Sahlberg
but the old_sha1 pointer is NULL. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 12 +++- refs.c | 18 -- refs.h | 14 +- 3 files changed, 28 insertions(+), 16

[PATCH v11 38/41] refs.c: pass a skip list to name_conflict_fn

2014-05-27 Thread Ronnie Sahlberg
will delete m from the packed ref 3, the transaction will create conflicting m/m For this case we want to be able to lock and create m/m since we know that the conflict is only transient. I.e. the conflict will be automatically resolved by the transaction when it deletes m. Signed-off-by: Ronnie

[PATCH v11 35/41] refs.c: pack all refs before we start to rename a ref

2014-05-27 Thread Ronnie Sahlberg
foo/bar foo'. If we can guarantee that foo/bar does not exist as a loose ref we can avoid locking foo/bar.lock during transaction commit and thus make it possible to delete the foo directory and re-create it as a file(branch) in a single transaction. Signed-off-by: Ronnie Sahlberg sahlb

[PATCH v11 19/41] commit.c: use ref transactions for updates

2014-05-27 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/commit.c | 24 +++- 1

[PATCH v11 30/41] refs.c: remove lock_ref_sha1

2014-05-27 Thread Ronnie Sahlberg
...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 979b79a..4ca84f7 100644 --- a/refs.c +++ b/refs.c @@ -2124,15 +2124,6 @@ static struct ref_lock *lock_ref_sha1_basic

[PATCH v11 26/41] walker.c: use ref transaction for ref updates

2014-05-27 Thread Ronnie Sahlberg
) repository which likely means that the type of collissions that the previous locking would protect against and cause the fetch to fail for to be even more rare. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- walker.c | 56 +--- 1 file changed, 33

[PATCH v11 31/41] refs.c: make prune_ref use a transaction to delete the ref

2014-05-27 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. Signed-off-by: Ronnie

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

2014-05-27 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. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- branch.c

[PATCH v11 15/41] refs.c: make ref_transaction_begin take an err argument

2014-05-27 Thread Ronnie Sahlberg
, a hypothetical MySQL backend could fail in _being with Can not connect to MySQL server. No route to host. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 2 +- refs.c | 2 +- refs.h | 2 +- 3 files

[PATCH v11 13/41] refs.c: change ref_transaction_create to do error checking and return status

2014-05-27 Thread Ronnie Sahlberg
that will be updated on failure. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 4 +++- refs.c | 18 -- refs.h | 25 ++--- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/builtin/update-ref.c b/builtin

[PATCH v11 41/41] refs.c: make write_ref_sha1 static

2014-05-27 Thread Ronnie Sahlberg
No external users call write_ref_sha1 any more so lets declare it static. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 6 +- refs.h | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index c108007..2b51547 100644 --- a/refs.c +++ b

[PATCH v11 22/41] branch.c: use ref transaction for all ref updates

2014-05-27 Thread Ronnie Sahlberg
up overwriting a branch even if the forcing flag is false. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- branch.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/branch.c b/branch.c index

[PATCH v11 21/41] fast-import.c: change update_branch to use ref transactions

2014-05-27 Thread Ronnie Sahlberg
Change update_branch() to use ref transactions for updates. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- fast-import.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/fast-import.c b/fast-import.c index 6707a66..4a7b196 100644 --- a/fast

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

2014-05-27 Thread Ronnie Sahlberg
ref_transaction_update() in which case this change is required. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 7 --- refs.h | 7 --- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 33541f4

[PATCH v11 07/41] refs.c: make ref_update_reject_duplicates take a strbuf argument for errors

2014-05-27 Thread Ronnie Sahlberg
-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 2da62ac..4c7f4f7 100644 --- a/refs.c +++ b/refs.c @@ -3410,6 +3410,7 @@ static int ref_update_compare(const void *r1, const void *r2) } static int

[PATCH v11 10/41] update-ref.c: log transaction error from the update_ref

2014-05-27 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 jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 10 +- 1 file changed, 5

[PATCH v11 06/41] refs.c: add an err argument to repack_without_refs

2014-05-27 Thread Ronnie Sahlberg
unable_to_lock_strbuf that takes a strbuf argument and fills in the reason for the failure. In commit_packed_refs, make sure that we propagate any errno that commit_lock_file might have set back to our caller. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- cache.h| 2 ++ lockfile.c | 21

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

2014-05-27 Thread Ronnie Sahlberg
and finally remove the onerr argument completely. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 2 +- refs.c | 6 +- refs.h | 5 - 3 files changed, 10 insertions(+), 3 deletions(-) diff

Re: [PATCH v11 08/41] refs.c: add an err argument to delete_ref_loose

2014-05-28 Thread Ronnie Sahlberg
On Tue, May 27, 2014 at 5:25 PM, Jonathan Nieder jrnie...@gmail.com wrote: Hi, Comments from http://marc.info/?l=gitm=140079653930751w=2: Ronnie Sahlberg wrote: [...] --- a/refs.c +++ b/refs.c @@ -2491,17 +2491,43 @@ static int repack_without_ref(const char *refname) return

Re: [PATCH v11 10/41] update-ref.c: log transaction error from the update_ref

2014-05-28 Thread Ronnie Sahlberg
On Tue, May 27, 2014 at 5:27 PM, Jonathan Nieder jrnie...@gmail.com wrote: Hi, Comments from http://marc.info/?l=gitm=140079653930751w=2: Ronnie Sahlberg wrote: [Subject: update-ref.c: log transaction error from the update_ref] The above description suggests that this is going to add new

Re: [PATCH v11 13/41] refs.c: change ref_transaction_create to do error checking and return status

2014-05-28 Thread Ronnie Sahlberg
On Tue, May 27, 2014 at 5:42 PM, Jonathan Nieder jrnie...@gmail.com wrote: Hi, Ronnie Sahlberg wrote: --- a/refs.h +++ b/refs.h @@ -215,6 +215,15 @@ enum action_on_err { }; /* + * Transaction functions that take an err argument will append an error + * string to this buffer

Re: [PATCH v11 06/41] refs.c: add an err argument to repack_without_refs

2014-05-28 Thread Ronnie Sahlberg
On Tue, May 27, 2014 at 5:11 PM, Jonathan Nieder jrnie...@gmail.com wrote: Hi, Comments from http://marc.info/?l=gitm=140079653930751w=2: Ronnie Sahlberg wrote: --- a/cache.h +++ b/cache.h @@ -559,6 +559,8 @@ struct lock_file { #define LOCK_DIE_ON_ERROR 1 #define LOCK_NODEREF 2

Re: [PATCH v11 13/41] refs.c: change ref_transaction_create to do error checking and return status

2014-05-28 Thread Ronnie Sahlberg
On Wed, May 28, 2014 at 10:07 AM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: Updated the comment in refs.h Thanks. +++ b/refs.h @@ -215,6 +215,31 @@ enum action_on_err { }; /* + * On error, transaction functions append a message about what + * went wrong

Re: [PATCH v11 13/41] refs.c: change ref_transaction_create to do error checking and return status

2014-05-28 Thread Ronnie Sahlberg
: Ronnie Sahlberg wrote: Please re-review. 06df8942 is Reviewed-by: Jonathan Nieder jrnie...@gmail.com Thanks. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v11 26/41] walker.c: use ref transaction for ref updates

2014-05-28 Thread Ronnie Sahlberg
On Wed, May 28, 2014 at 12:56 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: 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

Re: [PATCH v11 23/41] refs.c: change update_ref to use a transaction

2014-05-28 Thread Ronnie Sahlberg
Done. Thanks. On Wed, May 28, 2014 at 12:31 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: --- a/refs.c +++ b/refs.c @@ -3474,11 +3474,28 @@ int update_ref(const char *action, const char *refname, const unsigned char *sha1, const unsigned char *oldval

Re: [PATCH v11 16/41] refs.c: add transaction.status and track OPEN/CLOSED/ERROR

2014-05-28 Thread Ronnie Sahlberg
On Wed, May 28, 2014 at 11:51 AM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: --- a/refs.c +++ b/refs.c [...] @@ -3385,6 +3408,9 @@ int ref_transaction_update(struct ref_transaction *transaction, { struct ref_update *update; + if (transaction-state

Re: [PATCH v11 31/41] refs.c: make prune_ref use a transaction to delete the ref

2014-05-28 Thread Ronnie Sahlberg
On Wed, May 28, 2014 at 2:51 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: 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

Re: [PATCH v11 25/41] fast-import.c: use a ref transaction when dumping tags

2014-05-28 Thread Ronnie Sahlberg
On Wed, May 28, 2014 at 12:47 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: --- a/fast-import.c +++ b/fast-import.c @@ -1735,15 +1735,22 @@ static void dump_tags(void) { static const char *msg = fast-import; struct tag *t; - struct ref_lock *lock

Re: [PATCH v11 25/41] fast-import.c: use a ref transaction when dumping tags

2014-05-28 Thread Ronnie Sahlberg
On Wed, May 28, 2014 at 3:17 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: On Wed, May 28, 2014 at 12:47 PM, Jonathan Nieder jrnie...@gmail.com wrote: --- i/fast-import.c +++ w/fast-import.c @@ -1735,21 +1735,28 @@ static void dump_tags(void) { static const

[PATCH v12 00/44] Use ref transactions for all ref updates

2014-05-29 Thread Ronnie Sahlberg
This patch series can also be found at https://github.com/rsahlberg/git/tree/ref-transactions Ronnie please review these remaining patches in this series. Sahlberg (44): refs.c: constify the sha arguments for ref_transaction_create|delete|update refs.c: allow passing NULL to

[PATCH v12 25/41] fast-import.c: use a ref transaction when dumping tags

2014-05-29 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- fast-import.c | 29 +++-- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/fast-import.c b/fast-import.c index 4a7b196..587ef4a 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1735,15 +1735,32

[PATCH v12 40/41] fetch.c: change s_update_ref to use a ref transaction

2014-05-29 Thread Ronnie Sahlberg
Change s_update_ref to use a ref transaction for the ref update. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/fetch.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index faa1233..b13e8f9 100644

[PATCH v12 06/41] refs.c: add an err argument to repack_without_refs

2014-05-29 Thread Ronnie Sahlberg
unable_to_lock_message that takes a strbuf argument and fills in the reason for the failure. In commit_packed_refs, make sure that we propagate any errno that commit_lock_file might have set back to our caller. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- cache.h| 2 ++ lockfile.c | 21

[PATCH v12 08/41] refs.c: add an err argument to delete_ref_loose

2014-05-29 Thread Ronnie Sahlberg
unlink_or_err that we can call from delete_ref_loose. This function is similar to unlink_or_warn except that we can pass it an err argument. If err is non-NULL the function will populate err instead of printing a warning(). Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 35

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

2014-05-29 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. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- branch.c

[PATCH v12 31/41] refs.c: make prune_ref use a transaction to delete the ref

2014-05-29 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. Signed-off-by: Ronnie

[PATCH v12 16/41] refs.c: add transaction.status and track OPEN/CLOSED/ERROR

2014-05-29 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 sahlb...@google.com --- refs.c | 36 +++- 1

[PATCH v12 36/41] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-05-29 Thread Ronnie Sahlberg
caller and we will soon make changes to the signature to lock_ref_sha1_basic that we do not want to expose to that caller. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index 5680028..df00993

[PATCH v12 38/41] refs.c: pass a skip list to name_conflict_fn

2014-05-29 Thread Ronnie Sahlberg
will delete m from the packed ref 3, the transaction will create conflicting m/m For this case we want to be able to lock and create m/m since we know that the conflict is only transient. I.e. the conflict will be automatically resolved by the transaction when it deletes m. Signed-off-by: Ronnie

[PATCH v12 41/41] refs.c: make write_ref_sha1 static

2014-05-29 Thread Ronnie Sahlberg
No external users call write_ref_sha1 any more so lets declare it static. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 6 +- refs.h | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index 6414afc..aefa5bc 100644 --- a/refs.c +++ b

[PATCH v12 24/41] receive-pack.c: use a reference transaction for updating the refs

2014-05-29 Thread Ronnie Sahlberg
Wrap all the ref updates inside a transaction. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/receive-pack.c | 31 ++- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index c323081..13f4a63

[PATCH v12 39/41] refs.c: propagate any errno==ENOTDIR from _commit back to the callers

2014-05-29 Thread Ronnie Sahlberg
directly. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 23 --- refs.h | 4 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index ec8d642..6414afc 100644 --- a/refs.c +++ b/refs.c @@ -3504,7 +3504,7 @@ static int

[PATCH v12 26/41] walker.c: use ref transaction for ref updates

2014-05-29 Thread Ronnie Sahlberg
that this function is only called when fetching from a remote HTTP repository onto the local (most of the time single-user) repository which likely means that the type of collissions that the previous locking would protect against and cause the fetch to fail for to be even more rare. Signed-off-by: Ronnie Sahlberg

[PATCH v12 32/41] refs.c: make delete_ref use a transaction

2014-05-29 Thread Ronnie Sahlberg
. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 36 ++-- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/refs.c b/refs.c index 60593d7..e2c2249 100644 --- a/refs.c +++ b/refs.c @@ -2494,11 +2494,6 @@ static int repack_without_refs(const

Re: [PATCH v11 25/41] fast-import.c: use a ref transaction when dumping tags

2014-05-29 Thread Ronnie Sahlberg
On Wed, May 28, 2014 at 4:39 PM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: I rely on the fact that if the transaction has failed then it is safe to call ref_transaction_commit since it is guaranteed to return an error too. Yes, I am saying that behavior

Re: [PATCH v12 00/44] Use ref transactions for all ref updates

2014-05-29 Thread Ronnie Sahlberg
These patches are the remaining patches that need review in this series. Please review them. On Thu, May 29, 2014 at 9:07 AM, Ronnie Sahlberg sahlb...@google.com wrote: This patch series can also be found at https://github.com/rsahlberg/git/tree/ref-transactions Ronnie please review

[PATCH] refs.c: change read_ref_at to use the reflog iterators

2014-05-30 Thread Ronnie Sahlberg
the t1400 test to handle the cahnge in log messages. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c| 217 -- t/t1400-update-ref.sh | 4 +- 2 files changed, 122 insertions(+), 99 deletions(-) diff --git a/refs.c b

Re: [PATCH] refs.c: change read_ref_at to use the reflog iterators

2014-06-02 Thread Ronnie Sahlberg
On Fri, May 30, 2014 at 2:59 PM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: read_ref_at has its own parsing of the reflog file for no really good reason so lets change this to use the existing reflog iterators. This removes one instance where we

[PATCH] refs.c: change read_ref_at to use the reflog iterators

2014-06-02 Thread Ronnie Sahlberg
the t1400 test to handle the change in log messages. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c| 202 ++ t/t1400-update-ref.sh | 4 +- 2 files changed, 107 insertions(+), 99 deletions(-) diff --git a/refs.c b

Re: [PATCH] refs.c: change read_ref_at to use the reflog iterators

2014-06-03 Thread Ronnie Sahlberg
Thanks. On Mon, Jun 2, 2014 at 2:21 PM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: read_ref_at has its own parsing of the reflog file for no really good reason so lets change this to use the existing reflog iterators. This removes one instance where

[PATCH] refs.c: change read_ref_at to use the reflog iterators

2014-06-03 Thread Ronnie Sahlberg
to repair 'Log ... has gap ...' anyway. Adapt the t1400 test to handle the change in log messages. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c| 208 +- t/t1400-update-ref.sh | 4 +- 2 files changed, 105 insertions

Re: [PATCH v11 35/41] refs.c: pack all refs before we start to rename a ref

2014-06-03 Thread Ronnie Sahlberg
Thanks! On Fri, May 30, 2014 at 11:08 AM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: We want to do this to make it easier to handle atomic renames in rename_ref for the case 'git branch -m foo/bar foo'. In an ideal world, a part of me would rather see git branch -m

Re: [PATCH v11 32/41] refs.c: make delete_ref use a transaction

2014-06-03 Thread Ronnie Sahlberg
Thanks! On Fri, May 30, 2014 at 10:28 AM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 34 +- 1 file changed, 13 insertions(+), 21 deletions(-) Reviewed-by: Jonathan Nieder

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

2014-06-03 Thread Ronnie Sahlberg
On Fri, May 30, 2014 at 10:38 AM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: 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

Re: [PATCH v11 39/41] refs.c: propagate any errno==ENOTDIR from _commit back to the callers

2014-06-03 Thread Ronnie Sahlberg
On Fri, May 30, 2014 at 5:22 PM, Jonathan Nieder jrnie...@gmail.com wrote: Hi, Ronnie Sahlberg wrote: For these cases, save the errno value and abort and make sure that the caller can see errno==ENOTDIR. Also start defining specific return codes for _commit, assign -1 as a generic error

Re: [PATCH v11 36/41] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-06-03 Thread Ronnie Sahlberg
On Fri, May 30, 2014 at 11:12 AM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: 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. Do you know

Re: [PATCH v12 06/41] refs.c: add an err argument to repack_without_refs

2014-06-03 Thread Ronnie Sahlberg
Thanks. I have done all the additions of save_errno you suggested. On Thu, May 29, 2014 at 11:17 AM, Jonathan Nieder jrnie...@gmail.com wrote: Hi, Ronnie Sahlberg wrote: Update repack_without_refs to take an err argument and update it if there is a failure. Pass the err variable from

Re: [PATCH v11 25/41] fast-import.c: use a ref transaction when dumping tags

2014-06-03 Thread Ronnie Sahlberg
Thanks. I have changed the transaction functions to die(BUG:) if the user tries to call _update/_create/_delete on a failed transaction. On Thu, May 29, 2014 at 10:41 AM, Jonathan Nieder jrnie...@gmail.com wrote: Ronnie Sahlberg wrote: On Wed, May 28, 2014 at 4:39 PM, Jonathan Nieder jrnie

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

2014-06-03 Thread Ronnie Sahlberg
ref_transaction_update() in which case this change is required. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 7 --- refs.h | 7 --- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 33541f4

[PATCH v13 02/41] refs.c: ref_transaction_commit should not free the transaction

2014-06-03 Thread Ronnie Sahlberg
Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- 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

<    3   4   5   6   7   8   9   10   11   12   >