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

2014-06-03 Thread Ronnie Sahlberg
finally remove the onerr argument completely. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 2 +- refs.c | 6 +- refs.h | 5 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/builtin/update-ref.c b

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

2014-06-03 Thread Ronnie Sahlberg
. Update a whole bunch of other places to keep errno from beeing clobbered. Signed-off-by: Ronnie Sahlberg --- cache.h| 2 ++ lockfile.c | 37 + refs.c | 111 ++--- 3 files changed, 110 insertions(+), 40 deletions

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

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

[PATCH v13 10/41] update-ref: use err argument to get error from ref_transaction_commit

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

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

2014-06-03 Thread Ronnie Sahlberg
-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 245c540..bc750f4 100644 --- a/refs.c +++ b/refs.c @@ -2139,15 +2139,6 @@ static struct ref_lock *lock_ref_sha1_basic(

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

2014-06-03 Thread Ronnie Sahlberg
rolled back already. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- 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 ref_transaction *transac

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

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

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

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

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

2014-06-03 Thread Ronnie Sahlberg
up overwriting a branch even if the forcing flag is false. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- branch.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/branch.c b/branch.c index 660097b..c1eae00 100644 --- a/branch.c

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

2014-06-03 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 v13 36/41] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-06-03 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 --- refs.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c

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

2014-06-03 Thread Ronnie Sahlberg
. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 34 +- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/refs.c b/refs.c index e19041a..4cdbc26 100644 --- a/refs.c +++ b/refs.c @@ -2513,11 +2513,6 @@ static int repack_without_refs

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

2014-06-03 Thread Ronnie Sahlberg
updated on failure. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- 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

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

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

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

2014-06-03 Thread Ronnie Sahlberg
Wrap all the ref updates inside a transaction. Signed-off-by: Ronnie Sahlberg --- 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 100644 --- a

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

2014-06-03 Thread Ronnie Sahlberg
the old_sha1 pointer is NULL. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 12 +++- refs.c | 18 -- refs.h | 14 +- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/builtin

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

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

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

2014-06-03 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 --- refs.c | 35

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

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

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

2014-06-03 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 Signed-off-by: Ronnie Sahlberg --- refs.c | 35 +-- 1 file changed, 9 insertions

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

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

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

2014-06-03 Thread Ronnie Sahlberg
directly. Signed-off-by: Ronnie Sahlberg --- refs.c | 22 +++--- refs.h | 6 ++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index f2ca96a..bcf238e 100644 --- a/refs.c +++ b/refs.c @@ -3551,7 +3551,7 @@ static int ref_update_reject_duplicates

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

2014-06-03 Thread Ronnie Sahlberg
No external users call write_ref_sha1 any more so lets declare it static. Signed-off-by: Ronnie Sahlberg --- refs.c | 6 +- refs.h | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index bcf238e..f8a6c9a 100644 --- a/refs.c +++ b/refs.c @@ -2634,6

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

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

[PATCH 00/11] Add transaction support for reflog

2014-06-04 Thread Ronnie Sahlberg
This patch series is based on the ref-transaction series and is available at https://github.com/rsahlberg/git/tree/ref-transactions-reflog This patch series adds transaction support for updating the reflog. Ronnie Sahlberg (11): refs.c make ref_transaction_create a wrapper to

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

2014-06-04 Thread Ronnie Sahlberg
Add a flag that allows us to truncate the reflog before we write the update. Signed-off-by: Ronnie Sahlberg --- refs.c | 17 +++-- refs.h | 4 +++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/refs.c b/refs.c index b99fcd9..f2619e1 100644 --- a/refs.c +++ b

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

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

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

2014-06-04 Thread Ronnie Sahlberg
Use a transaction for all updates during expire_reflog. Signed-off-by: Ronnie Sahlberg --- builtin/reflog.c | 84 refs.c | 2 +- 2 files changed, 37 insertions(+), 49 deletions(-) diff --git a/builtin/reflog.c b/builtin

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

2014-06-04 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 --- refs.c | 24 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index

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

2014-06-04 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg --- refs.c | 15 +-- refs.h | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/refs.c b/refs.c index 2dfedf4..0c382f3 100644 --- a/refs.c +++ b/refs.c @@ -3482,16 +3482,11 @@ int ref_transaction_delete(struct ref_transaction

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

2014-06-04 Thread Ronnie Sahlberg
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 --- refs.c | 48 ++-- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/refs.c

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

2014-06-04 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 --- refs.c | 5 +++-- refs.h | 1 + 2 files changed, 4 insertions

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

2014-06-04 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg --- refs.c | 11 ++- refs.h | 7 --- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/refs.c b/refs.c index f8a6c9a..2dfedf4 100644 --- a/refs.c +++ b/refs.c @@ -3464,15 +3464,8 @@ int ref_transaction_create(struct ref_transaction

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

2014-06-04 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 --- refs.c | 101

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

2014-06-04 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, ); transaction_commit(t) where we first truncate the reflog and then build the new content one line at a time. S

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

2014-06-04 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 --- branch.c | 11 +++ builtin/commit.c | 14 - builtin/fetch.c| 12

[PATCH 0/4] Use transactions for renames

2014-06-05 Thread Ronnie Sahlberg
time at which stage all the refs-to-be-deleted all disappear in one atomic rename(). This allows us to perform transactions that delete multiple refs and have the delete appear as one atomic transaction to any external observer. Ronnie Sahlberg (4): refs.c: allow passing raw git_committer_info

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

2014-06-05 Thread Ronnie Sahlberg
ove the to-be-deleted refs from the packed refs, at which point all the deleted refs will disappear in one atomic rename operation. Signed-off-by: Ronnie Sahlberg --- refs.c | 146 ++--- 1 file changed, 114 insertions(+), 32 deletions(-)

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

2014-06-05 Thread Ronnie Sahlberg
Change refs.c to use a single transaction to copy/rename both the refs and its reflog. Since we are no longer using rename() to move the reflog file we no longer need to disallow rename_ref for refs with a symlink for its reflog so we can remove that test from the testsuite. Signed-off-by: Ronnie

[PATCH 1/2] refs.c: write updates to packed refs when a transaction has more than one ref

2014-06-05 Thread Ronnie Sahlberg
When we are updating more than one single ref, i.e. not a commit, then write the updated refs directly to the packed refs file instead of writing them as loose refs. Change clone to use a transaction instead of using the pacekd refs api. Signed-off-by: Ronnie Sahlberg --- builtin/clone.c | 16

[PATCH 2/2] refs.c: make the *_packed_refs functions static

2014-06-05 Thread Ronnie Sahlberg
We no longer need to expose the lock/add/commit/rollback functions for packed refs anymore so make them static and remove them from the api. Signed-off-by: Ronnie Sahlberg --- refs.c | 8 refs.h | 28 2 files changed, 4 insertions(+), 32 deletions(-) diff

[PATCH 1/4] refs.c: allow passing raw git_committer_info as email to _update_reflog

2014-06-05 Thread Ronnie Sahlberg
-by: Ronnie Sahlberg Conflicts: refs.c --- refs.c | 20 refs.h | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/refs.c b/refs.c index 9689592..e3a0383 100644 --- a/refs.c +++ b/refs.c @@ -3489,14 +3489,18 @@ int transaction_update_reflog(struct

[PATCH 0/2] Write multi-ref updates directly to packed refs

2014-06-05 Thread Ronnie Sahlberg
any external observer where all refs appear at once instead of one ref becoming visible at a time. Ronnie Sahlberg (2): refs.c: write updates to packed refs when a transaction has more than one ref refs.c: make the *_packed_refs functions static builtin/clone.c | 16 --- refs.c

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

2014-06-05 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 --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c b/refs.c index e3a0383..ab0b629 100644 --- a/refs.c +++ b/refs.c

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

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

[PATCH v14 02/40] refs.c: ref_transaction_commit should not free the transaction

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

[PATCH v14 37/40] refs.c: pass a skip list to name_conflict_fn

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

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

[PATCH v14 17/40] tag.c: use ref transactions when doing updates

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

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

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

[PATCH v14 15/40] refs.c: make ref_transaction_begin take an err argument

2014-06-06 Thread Ronnie Sahlberg
hypothetical MySQL backend could fail in _being with "Can not connect to MySQL server. No route to host". Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 2 +- refs.c | 2 +- refs.h | 2 +- 3 files changed, 3 insertions(+), 3

[PATCH v14 32/40] refs.c: make delete_ref use a transaction

2014-06-06 Thread Ronnie Sahlberg
. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 34 +- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/refs.c b/refs.c index e19041a..4cdbc26 100644 --- a/refs.c +++ b/refs.c @@ -2513,11 +2513,6 @@ static int repack_without_refs

[PATCH v14 36/40] refs.c: call lock_ref_sha1_basic directly from commit

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

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

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

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

2014-06-06 Thread Ronnie Sahlberg
updated on failure. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- 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

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

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

[PATCH v14 40/40] refs.c: make write_ref_sha1 static

2014-06-06 Thread Ronnie Sahlberg
No external users call write_ref_sha1 any more so lets declare it static. Signed-off-by: Ronnie Sahlberg --- refs.c | 6 +- refs.h | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index 9a3a501..c9d2a89 100644 --- a/refs.c +++ b/refs.c @@ -2634,6

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

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

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

2014-06-06 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 Signed-off-by: Ronnie Sahlberg --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c

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

2014-06-06 Thread Ronnie Sahlberg
the old_sha1 pointer is NULL. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 12 +++- refs.c | 18 -- refs.h | 14 +- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/builtin

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

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

[PATCH v14 38/40] refs.c: propagate any errno==ENOTDIR from _commit back to the callers

2014-06-06 Thread Ronnie Sahlberg
directly. Signed-off-by: Ronnie Sahlberg --- refs.c | 22 +++--- refs.h | 6 ++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index a5fd943..9a3a501 100644 --- a/refs.c +++ b/refs.c @@ -3548,7 +3548,7 @@ static int ref_update_reject_duplicates

[PATCH v14 35/40] refs.c: move the check for valid refname to lock_ref_sha1_basic

2014-06-06 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 --- refs.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c

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

2014-06-06 Thread Ronnie Sahlberg
updated on failure. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 4 +++- refs.c | 18 +++-- refs.h | 55 +--- 3 files changed, 63 insertions(+), 14 deletions(-) diff

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

2014-06-06 Thread Ronnie Sahlberg
Wrap all the ref updates inside a transaction. Signed-off-by: Ronnie Sahlberg --- 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 100644 --- a

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

2014-06-06 Thread Ronnie Sahlberg
Change update_branch() to use ref transactions for updates. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- 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

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

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

[PATCH v14 01/40] refs.c: remove ref_transaction_rollback

2014-06-06 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg --- 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 *ref_transaction_begin(void

[PATCH v14 11/40] refs.c: remove the onerr argument to ref_transaction_commit

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

[PATCH v14 27/40] refs.c: make lock_ref_sha1 static

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

[PATCH v14 23/40] refs.c: change update_ref to use a transaction

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

[PATCH v14 30/40] refs.c: remove lock_ref_sha1

2014-06-06 Thread Ronnie Sahlberg
-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- refs.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 245c540..bc750f4 100644 --- a/refs.c +++ b/refs.c @@ -2139,15 +2139,6 @@ static struct ref_lock *lock_ref_sha1_basic(

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

2014-06-06 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 v14 19/40] commit.c: use ref transactions for updates

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

[PATCH v14 22/40] branch.c: use ref transaction for all ref updates

2014-06-06 Thread Ronnie Sahlberg
up overwriting a branch even if the forcing flag is false. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- branch.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/branch.c b/branch.c index 660097b..c1eae00 100644 --- a/branch.c

[PATCH v14 00/40] Use ref transactions

2014-06-06 Thread Ronnie Sahlberg
cover all of JNs suggestions on the previous series. If I missed anything I appologize. ... Ronnie Sahlberg (40): refs.c: remove ref_transaction_rollback refs.c: ref_transaction_commit should not free the transaction refs.c: constify the sha arguments for ref_transaction_create|delete

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

2014-06-06 Thread Ronnie Sahlberg
finally remove the onerr argument completely. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 2 +- refs.c | 6 +- refs.h | 5 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/builtin/update-ref.c b

[PATCH v14 26/40] walker.c: use ref transaction for ref updates

2014-06-06 Thread Ronnie Sahlberg
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 v14 06/40] refs.c: add an err argument to repack_without_refs

2014-06-06 Thread Ronnie Sahlberg
. Update a whole bunch of other places to keep errno from beeing clobbered. Signed-off-by: Ronnie Sahlberg --- cache.h| 2 ++ lockfile.c | 37 + refs.c | 111 ++--- 3 files changed, 110 insertions(+), 40 deletions

[PATCH v14 10/40] update-ref: use err argument to get error from ref_transaction_commit

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

[PATCH v14 28/40] refs.c: remove the update_ref_lock function

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

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

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

[PATCH v14 08/40] refs.c: add an err argument to delete_ref_loose

2014-06-06 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 --- refs.c | 35

[PATCH v14 29/40] refs.c: remove the update_ref_write function

2014-06-06 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 Signed-off-by: Ronnie Sahlberg --- refs.c | 35 +-- 1 file changed, 9 insertions

[PATCH v14 04/40] refs.c: allow passing NULL to ref_transaction_free

2014-06-06 Thread Ronnie Sahlberg
rolled back already. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- 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 ref_transaction *transac

Re: [PATCH 1/2] refs.c: write updates to packed refs when a transaction has more than one ref

2014-06-09 Thread Ronnie Sahlberg
thanks On Sun, Jun 8, 2014 at 2:03 AM, Eric Sunshine wrote: > On Thu, Jun 5, 2014 at 7:26 PM, Ronnie Sahlberg wrote: >> When we are updating more than one single ref, i.e. not a commit, then >> write the updated refs directly to the packed refs file instead of writing >&g

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

2014-06-10 Thread Ronnie Sahlberg
Thanks. On Tue, Jun 10, 2014 at 1:10 PM, Jonathan Nieder wrote: > 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 that caller

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

2014-06-10 Thread Ronnie Sahlberg
pack-refs" 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 --- refs.c | 10 +- refs.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/r

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

2014-06-10 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg --- 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 *ref_transaction_begin(void

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

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

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

2014-06-10 Thread Ronnie Sahlberg
k to detect D/F conflicts Signed-off-by: Ronnie Sahlberg --- refs.c | 29 - 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/refs.c b/refs.c index a4c728c..31ae63e 100644 --- a/refs.c +++ b/refs.c @@ -1951,6 +1951,7 @@ static int remove_empty_dir

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

2014-06-10 Thread Ronnie Sahlberg
up overwriting a branch even if the forcing flag is false. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- branch.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/branch.c b/branch.c index 660097b..c1eae00 100644 --- a/branch.c

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

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

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

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

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

2014-06-10 Thread Ronnie Sahlberg
updated on failure. Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 4 +++- refs.c | 18 +++-- refs.h | 55 +--- 3 files changed, 63 insertions(+), 14 deletions(-) diff

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

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

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

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

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

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

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

2014-06-10 Thread Ronnie Sahlberg
hypothetical MySQL backend could fail in _being with "Can not connect to MySQL server. No route to host". Reviewed-by: Jonathan Nieder Signed-off-by: Ronnie Sahlberg --- builtin/update-ref.c | 2 +- refs.c | 2 +- refs.h | 2 +- 3 files changed, 3 insertions(+), 3

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

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

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