Re: [PATCH 03/16] refs: add methods for the ref iterators

2016-01-04 Thread Ronnie Sahlberg
On Sat, Jan 2, 2016 at 4:06 PM, David Aguilar <dav...@gmail.com> wrote: > Apologies for the late review, and this review should probably > go on patch 01 or 02 but I don't have it in my mbox atm... > > On Wed, Dec 02, 2015 at 07:35:08PM -0500, David Turner wrote: >> From

Re: [PATCH 0/8] Making reflog modifications part of the transactions API

2014-12-12 Thread ronnie sahlberg
On Fri, Dec 12, 2014 at 11:17 AM, Michael Haggerty mhag...@alum.mit.edu wrote: On 12/06/2014 03:46 AM, Stefan Beller wrote: This goes on top of Michaels series. The idea of this series is make the reflogs being part of the transaction API, so it will be part of the contract of

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-04 Thread ronnie sahlberg
On Thu, Dec 4, 2014 at 3:08 PM, Michael Haggerty mhag...@alum.mit.edu wrote: We don't actually need the locking functionality, because we already hold the lock on the reference itself, No. You do need the lock. The ref is locked only during transaction_commit() If you don't want to lock the

Re: [PATCH] refs.c: repack_without_refs may be called without error string buffer

2014-11-20 Thread Ronnie Sahlberg
.rc2.23.gca0107e LGTM Reviewed-by: Ronnie Sahlberg sahlb...@google.com Nit: While it does not hurt to allow passing NULL, at some stage later this function will become private to refs.c and ONLY be called from within transaction_commit() which will always pass a non-NULL err argument. At that stage

Re: [PATCH] refs.c: repack_without_refs may be called without error string buffer

2014-11-20 Thread Ronnie Sahlberg
On Thu, Nov 20, 2014 at 10:35 AM, Jonathan Nieder jrnie...@gmail.com wrote: Stefan Beller wrote: If we don't pass in the error string buffer, we skip over all parts dealing with preparing error messages. Please no. We tried this with the ref transaction code. When someone wants to

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

2014-11-18 Thread Ronnie Sahlberg
On Tue, Nov 18, 2014 at 3:26 AM, Michael Haggerty mhag...@alum.mit.edu wrote: On 11/18/2014 02:35 AM, Stefan Beller wrote: The following patch series updates the reflog handling to use transactions. This patch series has previously been sent to the list[1]. [...] I was reviewing this patch

Re: [PATCH 02/15] refs.c: return error instead of dying when locking fails during transaction

2014-11-11 Thread Ronnie Sahlberg
On Tue, Nov 11, 2014 at 2:34 AM, Jeff King p...@peff.net wrote: On Tue, Oct 21, 2014 at 01:36:47PM -0700, Ronnie Sahlberg wrote: commit e193c10fc4f9274d1e751cfcdcc4507818e8d498 upstream. Change lock_ref_sha1_basic to return an error instead of dying when we fail to lock a file during

[PATCH v3 00/16] ref-transaction-rename

2014-11-07 Thread Ronnie Sahlberg
reflog backend will provide optimized versions for these read whole reflog write whole reflog functions. Version 3: - Rename and redo the API for updating a whole reflog in one single operation to transaction_rename_reflog() Ronnie Sahlberg (16): refs.c: allow passing raw git_committer_info

[PATCH v3 04/16] refs.c: use a stringlist for repack_without_refs

2014-11-07 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/remote.c | 23 --- refs.c | 42 +- refs.h | 2 +- 3 files changed, 30 insertions(+), 37 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c

[PATCH v3 01/16] refs.c: allow passing raw git_committer_info as email to _update_reflog

2014-11-07 Thread Ronnie Sahlberg
, also go over and change all references from email to id where the code actually refers to a committer id and not just an email address. I.e. where the string is : NAME EMAIL Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- builtin/reflog.c | 19

[PATCH v3 07/16] refs.c: rollback the lockfile before we die() in repack_without_refs

2014-11-07 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 9a3c7fe..5a8f3da 100644 --- a/refs.c +++ b/refs.c @@ -2707,8 +2707,10 @@ int

[PATCH v3 16/16] refs.c: add an err argument to pack_refs

2014-11-07 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/pack-refs.c | 8 +++- refs.c | 7 +++ refs.h | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index b20b1ec..299768e 100644

[PATCH v3 11/16] refs.c: make repack_without_refs static

2014-11-07 Thread Ronnie Sahlberg
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 index c1db86f..2c6b0f6 100644 --- a/refs.c +++ b/refs.c @@ -2668,7 +2668,7 @@ static int curate_packed_ref_fn(struct ref_entry *entry

[PATCH v3 10/16] remote.c: use a transaction for deleting refs

2014-11-07 Thread Ronnie Sahlberg
Transactions now use packed refs when deleting multiple refs so there is no need to do it manually from remote.c any more. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/remote.c | 80 1 file changed, 40 insertions(+), 40

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

2014-11-07 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. This function is only called from transaction_commit() and it knows how to handle these failures. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder

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

2014-11-07 Thread Ronnie Sahlberg
the packed refs file, do other stuff, and later be able to call repack_without_refs with the lock already taken. This means we need some additional changes in remote.c to reflect the changes to the repack_without_refs semantics. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off

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

2014-11-07 Thread Ronnie Sahlberg
as a single atomic change to any external observers instead of a sequence of discreete changes. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/clone.c | 16 ++--- refs.c| 89 ++- t/t5516-fetch-push.sh | 2 +- 3

[PATCH v3 06/16] refs.c: update rename_ref to use a transaction

2014-11-07 Thread Ronnie Sahlberg
Change refs.c to use a single transaction to perform the rename. Change the function to return 1 on failure instead of either -1 or 1. These changes make the rename_ref operation atomic. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c| 168

[PATCH v3 2/7] send-pack.c: add an --atomic-push command line argument

2014-11-07 Thread Ronnie Sahlberg
failed to update since the atomic push operation failed. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- Documentation/git-send-pack.txt | 7 ++- builtin/send-pack.c | 6 +- remote.h| 3 ++- send-pack.c | 39

[PATCH v3 7/7] refs.c: add an err argument to create_symref

2014-11-07 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/branch.c | 7 +-- builtin/checkout.c | 13 ++--- builtin/clone.c| 15 +++ builtin/init-db.c | 8 ++-- builtin/notes.c| 7 --- builtin/remote.c | 26

[PATCH v3 0/7] ref-transaction-send-pack

2014-11-07 Thread Ronnie Sahlberg
a typo in a commit message. Ronnie Sahlberg (7): receive-pack.c: add protocol support to negotiate atomic-push send-pack.c: add an --atomic-push command line argument receive-pack.c: use a single transaction when atomic-push is negotiated push.c: add an --atomic-push argument t5543

[PATCH v3 6/7] refs.c: add an err argument to create_reflog

2014-11-07 Thread Ronnie Sahlberg
. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/checkout.c | 8 +++--- refs.c | 71 +++--- refs.h | 4 +-- 3 files changed, 42 insertions(+), 41 deletions(-) diff --git a/builtin/checkout.c b/builtin

[PATCH v3 5/7] t5543-atomic-push.sh: add basic tests for atomic pushes

2014-11-07 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- t/t5543-atomic-push.sh | 101 + 1 file changed, 101 insertions(+) create mode 100755 t/t5543-atomic-push.sh diff --git a/t/t5543-atomic-push.sh b/t/t5543-atomic-push.sh new file mode 100755

[PATCH v3 3/7] receive-pack.c: use a single transaction when atomic-push is negotiated

2014-11-07 Thread Ronnie Sahlberg
that there are no client scripts that depend on the old behavior we can change git to default to use atomic pushes and instead offer an opt-out argument for people that do not want atomic pushes. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/receive-pack.c | 73

[PATCH v3 05/16] refs.c: add transaction support for renaming a reflog

2014-11-07 Thread Ronnie Sahlberg
Add a new transaction function transaction_rename_reflog. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 72 +- refs.h | 8 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c

[PATCH v3 14/16] refs.c: make add_packed_ref return an error instead of calling die

2014-11-07 Thread Ronnie Sahlberg
Change add_packed_ref to return an error instead of calling die(). Update all callers to check the return value of add_packed_ref. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/refs.c b

[PATCH v3 15/16] refs.c: make lock_packed_refs take an err argument

2014-11-07 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/refs.c b/refs.c index 0829c55..1314a9a 100644 --- a/refs.c +++ b/refs.c @@ -2398,13 +2398,17 @@ static int write_packed_entry_fn(struct

[PATCH v3 12/16] refs.c: make the *_packed_refs functions static

2014-11-07 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 public api. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 8 refs.h | 30 -- 2 files changed, 4

[PATCH v3 13/16] refs.c: replace the onerr argument in update_ref with a strbuf err

2014-11-07 Thread Ronnie Sahlberg
Get rid of the action_on_err enum and replace the action argument to update_ref with a strbuf *err for error reporting. Update all callers to the new api including two callers in transport*.c which used the literal 0 instead of an enum. Signed-off-by: Ronnie Sahlberg sahlb...@google.com

[PATCH v3 4/7] push.c: add an --atomic-push argument

2014-11-07 Thread Ronnie Sahlberg
Add a command line argument to the git push command to request atomic pushes. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- Documentation/git-push.txt | 7 ++- builtin/push.c | 2 ++ transport.c| 1 + transport.h| 1 + 4 files changed, 10

Re: [PATCH v2 2/7] send-pack.c: add an --atomic-push command line argument

2014-11-04 Thread Ronnie Sahlberg
Fixed. Thanks On Tue, Nov 4, 2014 at 2:17 PM, Stefan Beller sbel...@google.com wrote: On Mon, Nov 3, 2014 at 11:12 AM, Ronnie Sahlberg sahlb...@google.com wrote: This adds support to send-pack to to negotiate and use atomic pushes /s/to to/to/ iff the server supports it. Atomic pushes

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

2014-11-03 Thread Ronnie Sahlberg
Use a transaction for all updates during expire_reflog. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- builtin/reflog.c | 85 refs.c | 4 +-- refs.h | 2 +- 3

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

2014-11-03 Thread Ronnie Sahlberg
objects. Such as ..git/config and .gitmodule. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- branch.c | 14 - builtin/commit.c | 10 +++ builtin/fetch.c| 12 builtin/receive-pack.c | 13

[PATCH v2 15/15] refs.c: allow deleting refs with a broken sha1

2014-11-03 Thread Ronnie Sahlberg
not actually be resolved to a sha1, they instead resolve to null_sha1 when these flags are used. For example, the ref: echo Broken ref .git/refs/heads/foo-broken-1 can now be deleted using git branch -d foo-broken-1 Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder

[PATCH v2 00/15] ref-transactions-reflog

2014-11-03 Thread Ronnie Sahlberg
othogonal features. - Improve the comments for the transaction flags field in refs.c: allow multiple reflog updates during a single transaction. Ronnie Sahlberg (15): refs.c make ref_transaction_create a wrapper to ref_transaction_update refs.c: make ref_transaction_delete a wrapper

[PATCH v2 13/15] refs.c: make unlock_ref/close_ref/commit_ref static

2014-11-03 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 Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 24 refs.h | 9 - 2 files changed, 12 insertions(+), 21

[PATCH v2 12/15] refs.c: rename log_ref_setup to create_reflog

2014-11-03 Thread Ronnie Sahlberg
(). Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- builtin/checkout.c | 8 +--- refs.c | 22 +- refs.h | 8 +++- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/builtin

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

2014-11-03 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 Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 27 +++ 1 file changed

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

2014-11-03 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 Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 48 ++-- 1

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

2014-11-03 Thread Ronnie Sahlberg
... + REFLOG_TRUNCATE and have it truncate the log and have it start fresh with an initial message that explains the log was truncated. This API allows that. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 5 +++-- refs.h | 1 + 2 files

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

2014-11-03 Thread Ronnie Sahlberg
the whole expire becomes O(n) instead of O(n2). If in the future we start doing this for many refs in one single transaction we might want to optimize this. But there is no need to complexify the code and optimize for future usecases that might never materialize at this stage. Signed-off-by: Ronnie

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

2014-11-03 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 Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c

[PATCH v2 06/15] copy.c: make copy_fd preserve meaningful errno

2014-11-03 Thread Ronnie Sahlberg
Update copy_fd to return a meaningful errno on failure. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- copy.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/copy.c b/copy.c index f2970ec..a8d366e

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

2014-11-03 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 Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 17 +++-- refs.h | 10 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff

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

2014-11-03 Thread Ronnie Sahlberg
The ref_transaction_update function can already be used to create refs by passing null_sha1 as the old_sha1 parameter. Simplify by replacing transaction_create with a thin wrapper. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c

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

2014-11-03 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 22 ++ refs.h | 2 +- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/refs.c b/refs.c index ed0485e..c607ab7 100644 --- a/refs.c +++ b/refs.c

[PATCH v2 14/15] refs.c: remove lock_any_ref_for_update

2014-11-03 Thread Ronnie Sahlberg
No one is using this function so we can delete it. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 7 --- refs.h | 9 + 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/refs.c b/refs.c index e4ad4f4

[PATCH v2 01/17] refs.c: allow passing raw git_committer_info as email to _update_reflog

2014-11-03 Thread Ronnie Sahlberg
, also go over and change all references from email to id where the code actually refers to a committer id and not just an email address. I.e. where the string is : NAME EMAIL Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- builtin/reflog.c | 19

[PATCH v2 00/17] ref-transaction-rename

2014-11-03 Thread Ronnie Sahlberg
reflog backend will provide optimized versions for these read whole reflog write whole reflog functions. Ronnie Sahlberg (17): refs.c: allow passing raw git_committer_info as email to _update_reflog refs.c: return error instead of dying when locking fails during transaction refs.c: use

[PATCH v2 02/17] refs.c: return error instead of dying when locking fails during transaction

2014-11-03 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. This function is only called from transaction_commit() and it knows how to handle these failures. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder

[PATCH v2 05/17] refs.c: add transaction support for replacing a reflog

2014-11-03 Thread Ronnie Sahlberg
Add a new transaction function transaction_replace_reflog. This function takes a blob and replaces the new or existing reflog with the content of this blob. This will be used by rename_ref where we basically want to copy the existing blob as is. Signed-off-by: Ronnie Sahlberg sahlb...@google.com

[PATCH v2 11/17] remote.c: use a transaction for deleting refs

2014-11-03 Thread Ronnie Sahlberg
Transactions now use packed refs when deleting multiple refs so there is no need to do it manually from remote.c any more. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/remote.c | 80 1 file changed, 40 insertions(+), 40

[PATCH v2 13/17] refs.c: make the *_packed_refs functions static

2014-11-03 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 public api. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 8 refs.h | 30 -- 2 files changed, 4

[PATCH v2 03/17] refs.c: use packed refs when deleting refs during a transaction

2014-11-03 Thread Ronnie Sahlberg
the packed refs file, do other stuff, and later be able to call repack_without_refs with the lock already taken. This means we need some additional changes in remote.c to reflect the changes to the repack_without_refs semantics. Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off

[PATCH v2 07/17] refs.c: update rename_ref to use a transaction

2014-11-03 Thread Ronnie Sahlberg
Change refs.c to use a single transaction to perform the rename. Change the function to return 1 on failure instead of either -1 or 1. These changes make the rename_ref operation atomic. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c| 173

[PATCH v2 16/17] refs.c: make lock_packed_refs take an err argument

2014-11-03 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/refs.c b/refs.c index 0b9cb8d..92e7714 100644 --- a/refs.c +++ b/refs.c @@ -2398,13 +2398,17 @@ static int write_packed_entry_fn(struct

[PATCH v2 04/17] refs.c: use a stringlist for repack_without_refs

2014-11-03 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/remote.c | 23 --- refs.c | 42 +- refs.h | 2 +- 3 files changed, 30 insertions(+), 37 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c

[PATCH v2 06/17] refs.c: add new function copy_reflog_into_strbuf

2014-11-03 Thread Ronnie Sahlberg
read_in_full the whole file into a strbuf. When we add other types of backends for refs we will need to implement similarly optimized versions of this functions for them. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 31 +++ 1 file changed, 31 insertions

[PATCH v2 12/17] refs.c: make repack_without_refs static

2014-11-03 Thread Ronnie Sahlberg
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 index 57e5d2f..56b0360 100644 --- a/refs.c +++ b/refs.c @@ -2668,7 +2668,7 @@ static int curate_packed_ref_fn(struct ref_entry *entry

[PATCH v2 09/17] refs.c: move reflog updates into its own function

2014-11-03 Thread Ronnie Sahlberg
some code out into a separate function. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 60 +++- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/refs.c b/refs.c index becf188..a3815d1 100644 --- a/refs.c +++ b

[PATCH v2 17/17] refs.c: add an err argument to pack_refs

2014-11-03 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/pack-refs.c | 8 +++- refs.c | 7 +++ refs.h | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index b20b1ec..299768e 100644

[PATCH v2 15/17] refs.c: make add_packed_ref return an error instead of calling die

2014-11-03 Thread Ronnie Sahlberg
Change add_packed_ref to return an error instead of calling die(). Update all callers to check the return value of add_packed_ref. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- refs.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/refs.c b

[PATCH v2 08/17] refs.c: rollback the lockfile before we die() in repack_without_refs

2014-11-03 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 44d38ab..becf188 100644 --- a/refs.c +++ b/refs.c @@ -2707,8 +2707,10 @@ int

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

2014-11-03 Thread Ronnie Sahlberg
as a single atomic change to any external observers instead of a sequence of discreete changes. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/clone.c | 16 ++--- refs.c| 89 ++- t/t5516-fetch-push.sh | 2 +- 3

[PATCH v2 14/17] refs.c: replace the onerr argument in update_ref with a strbuf err

2014-11-03 Thread Ronnie Sahlberg
Get rid of the action_on_err enum and replace the action argument to update_ref with a strbuf *err for error reporting. Update all callers to the new api including two callers in transport*.c which used the literal 0 instead of an enum. Signed-off-by: Ronnie Sahlberg sahlb...@google.com

[PATCH v2 5/7] t5543-atomic-push.sh: add basic tests for atomic pushes

2014-11-03 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- t/t5543-atomic-push.sh | 101 + 1 file changed, 101 insertions(+) create mode 100755 t/t5543-atomic-push.sh diff --git a/t/t5543-atomic-push.sh b/t/t5543-atomic-push.sh new file mode 100755

[PATCH v2 4/7] push.c: add an --atomic-push argument

2014-11-03 Thread Ronnie Sahlberg
Add a command line argument to the git push command to request atomic pushes. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- Documentation/git-push.txt | 7 ++- builtin/push.c | 2 ++ transport.c| 1 + transport.h| 1 + 4 files changed, 10

[PATCH v2 0/7] ref-transaction-send-pack

2014-11-03 Thread Ronnie Sahlberg
. With this series we can now perform atomic pushes to a repository. Version 2: - Reordered the capabilities we send so that agent= remains the last capability listed. - Reworded the paragraph for atomic push in git-send-pack.txt - Dropped the patch for receive.preferatomicpush Ronnie Sahlberg (7

[PATCH v2 2/7] send-pack.c: add an --atomic-push command line argument

2014-11-03 Thread Ronnie Sahlberg
failed to update since the atomic push operation failed. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- Documentation/git-send-pack.txt | 7 ++- builtin/send-pack.c | 6 +- remote.h| 3 ++- send-pack.c | 39

[PATCH v2 7/7] refs.c: add an err argument to create_symref

2014-11-03 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/branch.c | 7 +-- builtin/checkout.c | 13 ++--- builtin/clone.c| 15 +++ builtin/init-db.c | 8 ++-- builtin/notes.c| 7 --- builtin/remote.c | 26

[PATCH v2 3/7] receive-pack.c: use a single transaction when atomic-push is negotiated

2014-11-03 Thread Ronnie Sahlberg
that there are no client scripts that depend on the old behavior we can change git to default to use atomic pushes and instead offer an opt-out argument for people that do not want atomic pushes. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/receive-pack.c | 73

[PATCH v2 1/7] receive-pack.c: add protocol support to negotiate atomic-push

2014-11-03 Thread Ronnie Sahlberg
. This only adds protocol capability not ability for the user to activate it. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- Documentation/technical/protocol-capabilities.txt | 12 ++-- builtin/receive-pack.c| 6 +- send-pack.c

[PATCH v2 6/7] refs.c: add an err argument to create_reflog

2014-11-03 Thread Ronnie Sahlberg
. Signed-off-by: Ronnie Sahlberg sahlb...@google.com --- builtin/checkout.c | 8 +++--- refs.c | 71 +++--- refs.h | 4 +-- 3 files changed, 42 insertions(+), 41 deletions(-) diff --git a/builtin/checkout.c b/builtin

Re: [PATCH 05/15] refs.c: update rename_ref to use a transaction

2014-10-30 Thread Ronnie Sahlberg
On Wed, Oct 29, 2014 at 11:43 AM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: On Tue, Oct 28, 2014 at 2:12 PM, Junio C Hamano gits...@pobox.com wrote: More importantly, when you know that the end result you want to see is that the old and new log files

Re: [PATCH 1/8] receive-pack.c: add protocol support to negotiate atomic-push

2014-10-30 Thread Ronnie Sahlberg
On Thu, Oct 30, 2014 at 12:59 PM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: @@ -337,6 +341,8 @@ int send_pack(struct send_pack_args *args, strbuf_addstr(cap_buf, quiet); if (agent_supported) strbuf_addf(cap_buf

Re: [PATCH 2/8] send-pack.c: add an --atomic-push command line argument

2014-10-30 Thread Ronnie Sahlberg
On Thu, Oct 30, 2014 at 1:04 PM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt index 2a0de42..8f64feb 100644 --- a/Documentation/git-send-pack.txt +++ b/Documentation/git

Re: [PATCH 6/8] receive-pack.c: add a receive.preferatomicpush configuration variable

2014-10-30 Thread Ronnie Sahlberg
On Thu, Oct 30, 2014 at 1:11 PM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: Add receive.preferatomicpush setting to receive-pack.c. This triggers a new capability prefer-atomic-push to be sent back to the send-pack client, requesting the client

Re: [PATCH 6/8] receive-pack.c: add a receive.preferatomicpush configuration variable

2014-10-30 Thread Ronnie Sahlberg
On Thu, Oct 30, 2014 at 3:03 PM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: At some stage it may becomes too many preferences and over-engineered. Maybe I should drop this patch and then just require the plain if you want a push to be atomic, then use

Re: [PATCH 05/15] refs.c: update rename_ref to use a transaction

2014-10-29 Thread Ronnie Sahlberg
On Tue, Oct 28, 2014 at 2:12 PM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: I timed a git branch -m for a branch with ~2400 log entries and it takes neglible time : real 0m0.008s user 0m0.000s sys 0m0.007s I really hate this line of reasoning

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

2014-10-28 Thread Ronnie Sahlberg
On Thu, Oct 23, 2014 at 11:32 AM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: commit 020ed65a12838bdead64bc3c5de249d3c8f5cfd8 upstream. When performing a reflog transaction update, only write to the reflog iff msg is non-NULL. This can then be combined

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

2014-10-28 Thread Ronnie Sahlberg
On Thu, Oct 23, 2014 at 11:54 AM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: @@ -3531,7 +3537,7 @@ struct ref_update { enum transaction_update_type update_type; unsigned char new_sha1[20]; unsigned char old_sha1[20]; - int flags

Re: [PATCH 05/15] refs.c: update rename_ref to use a transaction

2014-10-28 Thread Ronnie Sahlberg
On Tue, Oct 28, 2014 at 12:56 PM, Junio C Hamano gits...@pobox.com wrote: Junio C Hamano gits...@pobox.com writes: Ronnie Sahlberg sahlb...@google.com writes: commit 0295e9cebc41020ee84da275549b164a8770ffba upstream. Change refs.c to use a single transaction to copy/rename both the refs

Re: [PATCH 01/15] refs.c make ref_transaction_create a wrapper to ref_transaction_update

2014-10-23 Thread Ronnie Sahlberg
On Thu, Oct 23, 2014 at 10:42 AM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: Subject: Re: [PATCH 01/15] refs.c make ref_transaction_create a wrapper to ref_transaction_update Missing colon after refs.c commit

Re: [PATCH 06/15] copy.c: make copy_fd preserve meaningful errno

2014-10-23 Thread Ronnie Sahlberg
On Thu, Oct 23, 2014 at 10:51 AM, Junio C Hamano gits...@pobox.com wrote: Ronnie Sahlberg sahlb...@google.com writes: commit 306805ccd147bfdf160b288a8d51fdf9b77ae0fa upstream. Update copy_fd to return a meaningful errno on failure. These two are good changes, but makes me wonder if more

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

2014-10-21 Thread Ronnie Sahlberg
commit 8d0a342375fbd926ae6ae93f9be42a436a787fb6 upstream. Add a flag that allows us to truncate the reflog before we write the update. Change-Id: I187b22e0910499b1976689b46866698b6fd46eb3 Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com

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

2014-10-21 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 102 +++-- refs.h | 12 2 files changed, 112 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index

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

2014-10-21 Thread Ronnie Sahlberg
a single lstat() instead of a open(O_CREAT)+lstat()+close(). Change-Id: Ib9493b3b81a97a0e154cc44303a5ed7cdceaaca7 Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- builtin/checkout.c | 8 +--- refs.c | 22

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

2014-10-21 Thread Ronnie Sahlberg
Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 27 ++- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/refs.c b/refs.c index 0368ed4..ed0485e 100644 --- a/refs.c +++ b/refs.c @@ -3623,31 +3623,8

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

2014-10-21 Thread Ronnie Sahlberg
commit a4369f77d1975566bcd29bfa46720d48372c241d upstream. unlock|close|commit_ref can be made static since there are no more external callers. Change-Id: I743f9daaa1c101fdc781a76283c2e8b462591d07 Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com

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

2014-10-21 Thread Ronnie Sahlberg
reflog transactions too which means that we will end up 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). Change-Id: I178e84a52af18c800844596af33dbc21bc076c1f Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed

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

2014-10-21 Thread Ronnie Sahlberg
commit 0beeda259297c92d411ecc92fa508ec7cfd87cc5 upstream. Change-Id: I685291986e544a8dc14f94c73b6a7c6400acd9d2 Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 22 ++ refs.h | 2 +- 2 files changed, 3

[PATCH 00/15] ref-transactions-reflog

2014-10-21 Thread Ronnie Sahlberg
of the series since we no longer need those functions. This series can also be found at https://github.com/rsahlberg/git/tree/ref-transactions-reflog Ronnie Sahlberg (15): refs.c make ref_transaction_create a wrapper to ref_transaction_update refs.c: make ref_transaction_delete a wrapper

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

2014-10-21 Thread Ronnie Sahlberg
never materialize at this stage. Change-Id: Ibe703310e33a4db07e5bcc704310211268b788fc Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 46 +- 1 file changed, 37 insertions(+), 9 deletions

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

2014-10-21 Thread Ronnie Sahlberg
discussed when the transactions could also operate on non ref objects. Such as ..git/config and .gitmodule. Change-Id: Iffdc56536be71c5061caa23040ce0d89efd52196 Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- branch.c | 14

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

2014-10-21 Thread Ronnie Sahlberg
: I44c89caa7e7c4960777b79cfb5d339a5aa3ddf7a Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 5 +++-- refs.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index d54c3b9..f14b76e 100644 --- a/refs.c +++ b/refs.c @@ -3895,8

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

2014-10-21 Thread Ronnie Sahlberg
commit 3a2f55c247ff290943fd552674e226062c13fd00 upstream. No one is using this function so we can delete it. Change-Id: I524dac239da500e5d4432328b997ed8ab34f6803 Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- refs.c | 7 --- refs.h

[PATCH 15/15] refs.c: allow deleting refs with a broken sha1

2014-10-21 Thread Ronnie Sahlberg
: I4e744d9e7d8b7e81dde5479965819117d03c98db Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- builtin/branch.c| 5 +++-- cache.h | 7 +++ refs.c | 6 ++ refs.h | 6 -- t

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

2014-10-21 Thread Ronnie Sahlberg
commit 5ac378cd8fad09a836d17fec379780854838bde5 upstream. Use a transaction for all updates during expire_reflog. Change-Id: Ieb81b2660cefeeecf0bcb3cdbc1ef3cbb86e7eb8 Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- builtin/reflog.c | 85

[PATCH 06/15] copy.c: make copy_fd preserve meaningful errno

2014-10-21 Thread Ronnie Sahlberg
commit 306805ccd147bfdf160b288a8d51fdf9b77ae0fa upstream. Update copy_fd to return a meaningful errno on failure. Change-Id: I771f9703acc816902affcf35ff2a56d9426315ac Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- copy.c | 15

[PATCH 03/15] refs.c: use packed refs when deleting refs during a transaction

2014-10-21 Thread Ronnie Sahlberg
: I1e4f58050acaabc6bcfa3409fbc0c2b866bb59aa Signed-off-by: Ronnie Sahlberg sahlb...@google.com Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- builtin/remote.c | 20 ++- refs.c | 155 ++- 2 files changed, 138 insertions(+), 37

  1   2   3   4   5   6   7   8   9   10   >