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

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

[PATCH v20 37/48] refs.c: remove lock_ref_sha1

2014-06-20 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 7113843..699f1f6 100644 --- a/refs.c +++ b/refs.c @@ -2170,15 +2170,6 @@ static struct ref_lock *lock_ref_sha1_basic

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

2014-06-20 Thread Ronnie Sahlberg
directly. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 22 +++--- refs.h | 6 ++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index c6990d0..74a55b5 100644 --- a/refs.c +++ b/refs.c @@ -3582,7 +3582,7 @@ static int

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

2014-06-20 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 v20 31/48] receive-pack.c: use a reference transaction for updating the refs

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

[PATCH v20 28/48] fast-import.c: change update_branch to use ref transactions

2014-06-20 Thread Ronnie Sahlberg
Change update_branch() to use ref transactions for updates. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- fast-import.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/fast-import.c b/fast

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

2014-06-20 Thread Ronnie Sahlberg
Reviewed-by: Jonathan Nieder jrnie...@gmail.com 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 d5206ee..a95e1be 100644 --- a/fast-import.c

[PATCH v20 34/48] refs.c: make lock_ref_sha1 static

2014-06-20 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 | 6 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/refs.c b/refs.c

[PATCH v20 35/48] refs.c: remove the update_ref_lock function

2014-06-20 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 v20 26/48] commit.c: use ref transactions for updates

2014-06-20 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 v20 33/48] walker.c: use ref transaction for ref updates

2014-06-20 Thread Ronnie Sahlberg
jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- walker.c | 59 +++ 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/walker.c b/walker.c index 1dd86b8..60d9f9e 100644 --- a/walker.c +++ b/walker.c

[PATCH v20 24/48] tag.c: use ref transactions when doing updates

2014-06-20 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 v20 36/48] refs.c: remove the update_ref_write function

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

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

2014-06-20 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 v20 29/48] branch.c: use ref transaction for all ref updates

2014-06-20 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 v20 27/48] sequencer.c: use ref transactions for all ref updates

2014-06-20 Thread Ronnie Sahlberg
Change to use ref transactions for all updates to refs. Reviewed-by: Jonathan Nieder jrnie...@gmail.com 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

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

2014-06-20 Thread Ronnie Sahlberg
that will be updated on failure. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 4 +++- refs.c | 18 +++-- refs.h | 55 +--- 3 files changed, 63

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

2014-06-20 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 v20 22/48] refs.c: make ref_transaction_begin take an err argument

2014-06-20 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 v20 30/48] refs.c: change update_ref to use a transaction

2014-06-20 Thread Ronnie Sahlberg
Change the update_ref helper function to use a ref transaction internally. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 28 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/refs.c b

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

2014-06-20 Thread Ronnie Sahlberg
that will be updated on failure. Reviewed-by: Jonathan Nieder jrnie...@gmail.com 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

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

2014-06-20 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 | 40 +++- 1

[PATCH v20 18/48] refs.c: remove the onerr argument to ref_transaction_commit

2014-06-20 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 v20 10/48] refs.c: verify_lock should set errno to something meaningful

2014-06-20 Thread Ronnie Sahlberg
wanted to create. Should git fetch also look for ENOTEMPTY or EEXIST to catch cases where a directory was in the way of a file to be created? Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 4 refs.h | 6 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git

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

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

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

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

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

2014-06-20 Thread Ronnie Sahlberg
-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 28 +++- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index 211429d..61570c9 100644 --- a/refs.c +++ b/refs.c @@ -2859,8 +2859,19 @@ static int log_ref_write(const char *refname, const

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

2014-06-20 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 v20 09/48] refs.c: make sure log_ref_setup returns a meaningful errno

2014-06-20 Thread Ronnie Sahlberg
Making errno when returning from log_ref_setup() meaningful, Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 27 +++ refs.h | 4 +++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/refs.c b/refs.c index 67a0217..9ea519c 100644

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

2014-06-20 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 v20 41/48] refs.c: pass the ref log message to _create/delete/update instead of _commit

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

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

2014-06-19 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 d9cac6d

[PATCH v19 00/48] Use ref transactions

2014-06-19 Thread Ronnie Sahlberg
meaningful 3, move a patch to change delete_loose_ref so it happens later in the series refs.c: add an err argument to delete_ref_loose Ronnie Sahlberg (48): refs.c: remove ref_transaction_rollback refs.c: ref_transaction_commit should not free the transaction refs.c: constify the sha arguments

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

2014-06-19 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 v19 48/48] refs.c: make write_ref_sha1 static

2014-06-19 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 | 10 -- refs.h | 3 --- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index f4234b9..1529a26 100644 --- a/refs.c

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

2014-06-19 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 | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/builtin/replace.c b/builtin

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

2014-06-19 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 v19 43/48] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-06-19 Thread Ronnie Sahlberg
names. If we need such recovery code we could add it as an option to git fsck and have git fsck be the only sanctioned way of bypassing the normal API and checks. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git

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

2014-06-19 Thread Ronnie Sahlberg
Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 29 + refs.h | 14 -- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 441c0bc..7c46d13 100644 --- a/refs.c +++ b/refs.c @@ -25,6

[PATCH v19 30/48] refs.c: change update_ref to use a transaction

2014-06-19 Thread Ronnie Sahlberg
Change the update_ref helper function to use a ref transaction internally. Reviewed-by: Jonathan Nieder jrnie...@gmail.com 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

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

2014-06-19 Thread Ronnie Sahlberg
directly. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 22 +++--- refs.h | 6 ++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index 6b5fc09..f4234b9 100644 --- a/refs.c +++ b/refs.c @@ -3579,7 +3579,7 @@ static int

[PATCH v19 40/48] refs.c: add an err argument to delete_ref_loose

2014-06-19 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(). Simplify warn_if_unremovable. Signed-off-by: Ronnie Sahlberg sahlb

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

2014-06-19 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 v19 10/48] refs.c: verify_lock should set errno to something meaningful

2014-06-19 Thread Ronnie Sahlberg
wanted to create. Should git fetch also look for ENOTEMPTY or EEXIST to catch cases where a directory was in the way of a file to be created? Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 4 refs.h | 6 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git

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

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

[PATCH v19 35/48] refs.c: remove the update_ref_lock function

2014-06-19 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 v19 15/48] refs.c: make ref_update_reject_duplicates take a strbuf argument for errors

2014-06-19 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 61570c9..115f143 100644 --- a/refs.c +++ b/refs.c @@ -3488,6 +3488,7 @@ static int ref_update_compare(const void *r1, const void *r2) } static int

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

2014-06-19 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 | 33 +++-- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index faa1233..52f1ebc

[PATCH v19 37/48] refs.c: remove lock_ref_sha1

2014-06-19 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 6792938..441c0bc 100644 --- a/refs.c +++ b/refs.c @@ -2170,15 +2170,6 @@ static struct ref_lock *lock_ref_sha1_basic

[PATCH v19 33/48] walker.c: use ref transaction for ref updates

2014-06-19 Thread Ronnie Sahlberg
jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- walker.c | 59 +++ 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/walker.c b/walker.c index 1dd86b8..60d9f9e 100644 --- a/walker.c +++ b/walker.c

[PATCH v19 04/48] refs.c: allow passing NULL to ref_transaction_free

2014-06-19 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 21ed465..1d6dece 100644 --- a/refs.c +++ b/refs.c @@ -3338,6 +3338,9 @@ void ref_transaction_free(struct

[PATCH v19 42/48] refs.c: pass NULL as *flags to read_ref_full

2014-06-19 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 v19 08/48] refs.c: add an err argument to repack_without_refs

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

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

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

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

2014-06-19 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 | 40 +++- 1

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

2014-06-19 Thread Ronnie Sahlberg
that will be updated on failure. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/update-ref.c | 4 +++- refs.c | 18 +++-- refs.h | 55 +--- 3 files changed, 63

[PATCH v19 39/48] refs.c: make delete_ref use a transaction

2014-06-19 Thread Ronnie Sahlberg
. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 34 +- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/refs.c b/refs.c index 7c46d13..15cc5f9 100644 --- a/refs.c +++ b/refs.c @@ -2544,11

[PATCH v19 27/48] sequencer.c: use ref transactions for all ref updates

2014-06-19 Thread Ronnie Sahlberg
Change to use ref transactions for all updates to refs. Reviewed-by: Jonathan Nieder jrnie...@gmail.com 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

[PATCH v19 26/48] commit.c: use ref transactions for updates

2014-06-19 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 v19 28/48] fast-import.c: change update_branch to use ref transactions

2014-06-19 Thread Ronnie Sahlberg
Change update_branch() to use ref transactions for updates. Reviewed-by: Jonathan Nieder jrnie...@gmail.com Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- fast-import.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/fast-import.c b/fast

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

2014-06-19 Thread Ronnie Sahlberg
Reviewed-by: Jonathan Nieder jrnie...@gmail.com 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 cd929dc..191fc47 100644 --- a/fast-import.c

[PATCH v19 18/48] refs.c: remove the onerr argument to ref_transaction_commit

2014-06-19 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 v19 24/48] tag.c: use ref transactions when doing updates

2014-06-19 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 v19 22/48] refs.c: make ref_transaction_begin take an err argument

2014-06-19 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 v19 21/48] refs.c: update ref_transaction_delete to check for error and return status

2014-06-19 Thread Ronnie Sahlberg
that will be updated on failure. Reviewed-by: Jonathan Nieder jrnie...@gmail.com 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

[PATCH v19 36/48] refs.c: remove the update_ref_write function

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

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

2014-06-19 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 dc45774..6d841a0 100644 --- a/refs.c +++ b/refs.c @@ -3334,7 +3334,7 @@ struct ref_transaction

[PATCH v19 34/48] refs.c: make lock_ref_sha1 static

2014-06-19 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 | 6 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/refs.c b/refs.c

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

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

[PATCH v19 29/48] branch.c: use ref transaction for all ref updates

2014-06-19 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 v19 19/48] refs.c: change ref_transaction_update() to do error checking and return status

2014-06-19 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 v19 11/48] refs.c: make remove_empty_directories always set errno to something sane

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

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

2014-06-19 Thread Ronnie Sahlberg
-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 28 +++- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index 211429d..61570c9 100644 --- a/refs.c +++ b/refs.c @@ -2859,8 +2859,19 @@ static int log_ref_write(const char *refname, const

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

2014-06-19 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 v19 02/48] refs.c: ref_transaction_commit should not free the transaction

2014-06-19 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

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

2014-06-19 Thread Ronnie Sahlberg
and prepares for repack_without_refs() to get a meaningful error message when commit_packed_refs() fails without falling into the same bug. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 10 +- refs.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/refs.c b

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

2014-06-19 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 v18 16/48] refs.c: add an err argument to delete_ref_loose

2014-06-19 Thread Ronnie Sahlberg
I have resent v19 that does 1, remove the spurios redundant errno line 2, fixes the type and 3, reorders the patch as mentioned previously in this thread. This I hope will be the final version of the series we will need. regards ronnie sahlberg On Wed, Jun 18, 2014 at 3:38 PM, Michael Haggerty

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

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

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

2014-06-19 Thread Ronnie Sahlberg
Making errno when returning from log_ref_setup() meaningful, Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 27 +++ refs.h | 4 +++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/refs.c b/refs.c index 67a0217..9ea519c 100644

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

2014-06-19 Thread Ronnie Sahlberg
advice based on errno, despite errno potentially being zero and potentially having been clobbered by that point Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- lockfile.c | 17 - refs.c | 1 + refs.h | 1 + 3 files changed, 14 insertions(+), 5 deletions

Re: [PATCH v4 0/1] receive-pack: optionally deny case clone refs

2014-06-18 Thread Ronnie Sahlberg
On Wed, Jun 18, 2014 at 4:33 AM, Michael Haggerty mhag...@alum.mit.edu wrote: On 06/13/2014 11:25 PM, Junio C Hamano wrote: Ronnie Sahlberg sahlb...@google.com writes: It gets even more hairy : If the server has A/a and a/b and you clone it it becomes A/a and A/b locally. Then you push back

[PATCH v3 08/14] refs.c: add a flag to allow reflog updates to truncate the log

2014-06-18 Thread Ronnie Sahlberg
Add a flag that allows us to truncate the reflog before we write the update. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 17 +++-- refs.h | 10 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/refs.c b/refs.c index d673a0f..c33d19e 100644

[PATCH v3 05/14] refs.c: add a function to append a reflog entry to a fd

2014-06-18 Thread Ronnie Sahlberg
with only a single place where we write a reflog entry to a file instead of the current two places (log_ref_write and builtin/reflog.c). Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 48 ++-- 1 file changed, 30 insertions(+), 18 deletions

[PATCH v3 02/14] refs.c: make ref_transaction_delete a wrapper for ref_transaction_update

2014-06-18 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 17 + refs.h | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/refs.c b/refs.c index a9f91ab..0eace70 100644 --- a/refs.c +++ b/refs.c @@ -3503,24 +3503,17 @@ int ref_transaction_delete(struct

[PATCH v3 14/14] refs.c: remove lock_any_ref_for_update

2014-06-18 Thread Ronnie Sahlberg
No one is using this function so we can delete it. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 7 --- refs.h | 10 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/refs.c b/refs.c index ff98682..95c3eb8 100644 --- a/refs.c +++ b/refs.c

[PATCH v3 12/14] refs.c: rename log_ref_setup to create_reflog

2014-06-18 Thread Ronnie Sahlberg
(). Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/checkout.c | 8 +--- refs.c | 22 +- refs.h | 8 +++- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index f1dc56e..808c58f

[PATCH v3 10/14] refs.c: allow multiple reflog updates during a single transaction

2014-06-18 Thread Ronnie Sahlberg
code such as: t = transaction_begin() transaction_reflog_update(t, foo, REFLOG_TRUNCATE, NULL); loop-over-somehting... transaction_reflog_update(t, foo, 0, message); transaction_commit(t) where we first truncate the reflog and then build the new content one line at a time. Signed-off-by: Ronnie

[PATCH v3 09/14] refs.c: only write reflog update if msg is non-NULL

2014-06-18 Thread Ronnie Sahlberg
When performing a reflog transaction update, only write to the reflog iff msg is non-NULL. This can then be combined with REFLOG_TRUNCATE to perform an update that only truncates but does not write. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 5 +++-- refs.h | 1 + 2 files

[PATCH v3 03/14] refs.c: rename the transaction functions

2014-06-18 Thread Ronnie Sahlberg
Rename the transaction functions. Remove the leading ref_ from the names and append _sha1 to the names for functions that create/delete/ update sha1 refs. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- branch.c | 11 --- builtin/commit.c | 14 - builtin

[PATCH v3 13/14] refs.c: make unlock_ref/close_ref/commit_ref static

2014-06-18 Thread Ronnie Sahlberg
unlock|close|commit_ref can be made static since there are no more external callers. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 24 refs.h | 9 - 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/refs.c b/refs.c index 9653a01

[PATCH v3 04/14] refs.c: add a new update_type field to ref_update

2014-06-18 Thread Ronnie Sahlberg
Add a field that describes what type of update this refers to. For now the only type is UPDATE_SHA1 but we will soon add more types. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/refs.c

[PATCH v3 11/14] reflog.c: use a reflog transaction when writing during expire

2014-06-18 Thread Ronnie Sahlberg
Use a transaction for all updates during expire_reflog. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/reflog.c | 84 refs.c | 4 +-- refs.h | 2 +- 3 files changed, 39 insertions(+), 51 deletions

[PATCH v3 00/14] ref-transactions-reflog

2014-06-18 Thread Ronnie Sahlberg
on reflogs can now be made private to refs.c since we no longer need to export them. This is version 3: - Update and rebased ontop of the current ref-transactions series. Ronnie Sahlberg (14): refs.c make ref_transaction_create a wrapper to ref_transaction_update refs.c: make ref_transaction_delete

[PATCH v3 07/14] refs.c: add a transaction function to append a reflog entry

2014-06-18 Thread Ronnie Sahlberg
Define a new transaction update type, UPDATE_LOG, and a new function transaction_update_reflog. This function will lock the reflog and append an entry to it during transaction commit. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 101

[PATCH v3 01/14] refs.c make ref_transaction_create a wrapper to ref_transaction_update

2014-06-18 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 13 ++--- refs.h | 7 --- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/refs.c b/refs.c index dfbf003..a9f91ab 100644 --- a/refs.c +++ b/refs.c @@ -3487,23 +3487,14 @@ int ref_transaction_create(struct

[PATCH v3 06/14] lockfile.c: make hold_lock_file_for_append preserve meaningful errno

2014-06-18 Thread Ronnie Sahlberg
Update hold_lock_file_for_append and copy_fd to return a meaningful errno on failure. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- copy.c | 20 +--- lockfile.c | 7 ++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/copy.c b/copy.c index

[PATCH v3 2/5] refs.c: return error instead of dying when locking fails during transaction

2014-06-18 Thread Ronnie Sahlberg
Change lock_ref_sha1_basic to return an error instead of dying when we fail to lock a file during a transaction. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 11dcb07..a644e7c 100644

[PATCH v3 4/5] refs.c: update rename_ref to use a transaction

2014-06-18 Thread Ronnie Sahlberg
to return 1 on failure instead of either -1 or 1. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c| 192 ++ t/t3200-branch.sh | 7 -- 2 files changed, 65 insertions(+), 134 deletions(-) diff --git a/refs.c b/refs.c

[PATCH v3 3/5] refs.c: use packed refs when deleting refs during a transaction

2014-06-18 Thread Ronnie Sahlberg
refs from the packed refs, at which point all the deleted refs will disappear in one atomic rename operation. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/remote.c | 13 +++-- refs.c | 150 +++ 2 files changed, 127

<    1   2   3   4   5   6   7   8   9   10   >