On Sat, Jan 2, 2016 at 4:06 PM, David Aguilar 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: Ronnie Sahlbe
On Tue, May 13, 2014 at 3:44 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
>> Allow ref_transaction_free to be called with NULL and in extension allow
>> ref_transaction_rollback to be called for a NULL transaction.
>
> In extension = as a result?
>
> Makes
On Tue, May 13, 2014 at 3:22 PM, Felipe Contreras
wrote:
> Junio C Hamano wrote:
>> Felipe Contreras writes:
>>
>> > The tools are now maintained out-of-tree, and they have a regression in
>> > v2.0.
>>
>> You seem not to understand at all what a regression is.
>>
>> My understanding is that vers
Thanks.
I changed the commit message.
On Tue, May 13, 2014 at 3:44 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
>> Allow ref_transaction_free to be called with NULL and in extension allow
>> ref_transaction_rollback to be called for a NULL transaction.
>
> In
Thanks.
Comment added and whitespace fixed.
On Tue, May 13, 2014 at 4:10 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
>> Add a strbuf argument to _commit so that we can pass an error string back to
>> the caller. So that we can do error logging from the caller instead
Thanks.
I updated the commit message to highlight that this means the error
string can now be passed all the way back to the caller.
On Tue, May 13, 2014 at 5:04 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
>> Make ref_update_reject_duplicates return any error that occu
On Tue, May 13, 2014 at 4:37 PM, Felipe Contreras
wrote:
> Ronnie Sahlberg wrote:
>> Could you please calm down and adjust your behavior. This constant
>> hostility and rudeness makes the mailing list very unpleasant.
>
> I explaind that to him multiple times. In the ma
Change ref_transaction_delete() to do basic error checking and return
non-zero of error. Update all callers to check the return for
ref_transaction_delete(). There are currently no conditions in _delete that
will return error but there will be in the future.
Signed-off-by: Ronnie Sahlberg
Change update_branch() to use ref transactions for updates.
Signed-off-by: Ronnie Sahlberg
---
fast-import.c | 22 ++
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 6707a66..79d219b 100644
--- a/fast-import.c
+++ b/fast
Change the update_ref helper function to use a ref transaction internally.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 25 +
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 64e3d53..55aa5a9 100644
--- a/refs.c
+++ b/refs.c
@@ -3405,11
!!oldval) ||
ref_transaction_commit(&t, action, &err)) {
ref_transaction_rollback(t);
... die/return ...
ref_transaction_free(transaction);
Signed-off-by: Ronnie Sahlberg
---
branch.c | 1 +
builtin/commit.c | 1 +
builtin/replace.
lock_any_ref_for_update/write_ref_sha1
did not protect against the ref already existsing. I.e. one thread could end up
overwriting a branch even if the forcing flag is false.
Signed-off-by: Ronnie Sahlberg
---
branch.c | 30 --
1 file changed, 16 insertions(+), 14 deletions(-)
diff
This means that most loose refs will no longer be present after the rename
which triggered a test failure since it assumes the file for an unrelated
ref would still be present after the rename.
Signed-off-by: Ronnie Sahlberg
---
refs.c| 3 +++
t/t3200-branch.sh | 2 +-
2 files
Skip using the lock_any_ref_for_update wrapper and call lock_ref_sha1_basic
directly from the commit function.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/refs.c b/refs.c
index 6556417..a376dd6 100644
--- a/refs.c
caller and we will soon
make changes to the signature to lock_ref_sha1_basic that we do not want to
expose to that caller.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/refs.c b/refs.c
index 157a094..6556417 100644
--- a/refs.c
lock_ref_sha1 was only called from one place in refc.c and only provided
a check that the refname was sane before adding back the initial "refs/"
part of the ref path name, the initial "refs/" that this caller had already
stripped off before calling lock_ref_sha1.
Signed-off
Change the reference transactions so that we pass the reflog message
through to the create/delete/update function instead of the commit message.
This allows for individual messages for each change in a multi ref
transaction.
Signed-off-by: Ronnie Sahlberg
---
branch.c | 6
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.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/refs.c b/refs.c
index 9ac9f38
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
Signed-off-by: Ronnie Sahlberg
---
refs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/refs.c b/refs.c
index 8e12386..aed700b 100644
--- a/refs.c
+++ b/refs.c
@@ -260,8 +260,6 @@ struct ref_entry {
};
static void read_loose_refs(const char *dirname, struct ref_dir *dir);
-static int
Wrap all the ref updates inside a transaction to make the update atomic.
Signed-off-by: Ronnie Sahlberg
---
builtin/receive-pack.c | 20 ++--
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index c323081..d580176
Change delete_ref to use a ref transaction for the deletion. At the same time
since we no longer have any callers of repack_without_ref we can now delete
this function.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 31 ++-
1 file changed, 10 insertions(+), 21 deletions
re correct, since if there was a problem
we would not even try to commit the transaction but need to highlight this
change in how/what errors are reported.
This change in what error is returned only occurs if there are multiple
refs that fail to update and only some, but not all, of them fail due
Change s_update_ref to use a ref transaction for the ref update.
Signed-off-by: Ronnie Sahlberg
---
builtin/fetch.c | 17 +
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index a93c893..b41d7b7 100644
--- a/builtin/fetch.c
+++ b
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 | 37 +
1 file changed, 33
Change to use ref transactions for all updates to refs.
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..9282a12 100644
--- a/sequencer.c
+++ b/sequencer.c
Since we only call update_ref_write from a single place and we only call it
with onerr==QUIET_ON_ERR we can just as well get rid of it and just call
write_ref_sha1 directly.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 35 +--
1 file changed, 9 insertions(+), 26
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.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 30 ++
1 file changed, 6 insertions(+), 24 deletions
Change rename_ref to use a single transaction to perform the ref rename.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 73 ++
1 file changed, 20 insertions(+), 53 deletions(-)
diff --git a/refs.c b/refs.c
index 7569f4e..8e12386
) 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
---
walker.c | 51 ++-
1 file changed, 26 insertions(+), 25
No external callers reference lock_ref_sha1 any more so lets declare it static.
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 0e88197..b7fa79b 100644
--- a/refs.c
+++ b/refs.c
@@ -2126,7
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
: Ronnie Sahlberg
---
refs.c | 23 +++
1 file changed, 23 insertions(+)
diff --git a/refs.c b/refs.c
index a376dd6..6b8b7fe 100644
--- a/refs.c
+++ b/refs.c
@@ -33,6 +33,10 @@ static inline int bad_ref_char(int ch)
* pruned.
*/
#define REF_ISPRUNING 0x0100
+/** Deletion of a
No external users call write_ref_sha1 any more so lets declare it static.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 4 +++-
refs.h | 3 ---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 4673cf4..0e88197 100644
--- a/refs.c
+++ b/refs.c
@@ -251,6 +251,8
Signed-off-by: Ronnie Sahlberg
---
fast-import.c | 17 -
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 3e356da..5587cf6 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1736,15 +1736,22 @@ static void dump_tags(void
(BUG:...) if we are calling
_update with have_old but the old_sha1 pointer is NULL.
Signed-off-by: Ronnie Sahlberg
---
builtin/update-ref.c | 10 ++
refs.c | 9 +++--
refs.h | 11 ++-
3 files changed, 19 insertions(+), 11 deletions(-)
diff --git a
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.
Signed-off-by: Ronnie Sahlberg
---
builtin/update-ref.c | 3 +--
refs.c | 22 +++---
refs.h
Change tag.c to use ref transactions for all ref updates.
Signed-off-by: Ronnie Sahlberg
---
builtin/tag.c | 14 --
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/builtin/tag.c b/builtin/tag.c
index c6e8a71..bf2a5c3 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
Do basic error checking in ref_transaction_create() and make it return
non-zero on error. Update all callers to check the result of
ref_transaction_create(). There are currently no conditions in _create that
will return error but there will be in the future.
Signed-off-by: Ronnie Sahlberg
why
the change in locking semantics should not be harmful.
Ronnie Sahlberg (42):
refs.c: constify the sha arguments for
ref_transaction_create|delete|update
refs.c: allow passing NULL to ref_transaction_free
refs.c: add a strbuf argument to ref_transaction_commit for erro
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.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 9 ++---
1 file changed, 6 insertions
ref_transaction_update() in which case this change is required.
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 6898263..2114748 100644
--- a/refs.c
+++ b/refs.c
@@ -3338,7 +3338,8
Update replace.c to use ref transactions for updates.
Signed-off-by: Ronnie Sahlberg
---
builtin/replace.c | 14 --
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/builtin/replace.c b/builtin/replace.c
index 3da1bae..11dc2e1 100644
--- a/builtin/replace.c
+++ b/builtin
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.
Signed-off-by: Ronnie Sahlberg
---
builtin/commit.c | 23 ++-
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/builtin
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
t()
then transaction is untouched and then ref_transaction_rollback(transaction)
will rollback the failed transaction.
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 2114748..88d73c8 100644
---
We have to free the transaction before returning in the early check for
'return early if number of updates == 0' or else the following code would
create a memory leak with the transaction never being freed :
t = ref_transaction_begin()
ref_transaction_commit(t)
Signed-off-
unrelated ENOTDIR may cause us to return the wrong error. Clear errno before
calling any functions if we check errno afterwards.
Also skip initializing a static variable to 0. Statics live in .bss and
are all automatically initialized to 0.
Signed-off-by: Ronnie Sahlberg
---
builtin/fetch.c | 4
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.
Signed-off-by: Ronnie Sahlberg
---
builtin/update-ref.c | 10 +-
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/update-ref.c b
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
-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 8129b20..46a31c1 100644
--- a/refs.c
+++ b/refs.c
@@ -3396,14 +3396,18 @@ int transaction_update_reflog(struct
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 | 8 +---
refs.h | 1 +
2 files changed, 6
Move the struct ref_update definition and some enums to earlier in the file.
This does not change any actual code or definitions but just moves them
to a different place in the code since we will soon reference some of these
from the rename_ref function.
Signed-off-by: Ronnie Sahlberg
Conflicts
: Ronnie Sahlberg
---
refs.c | 18 ++
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/refs.c b/refs.c
index 8212d77..b006238 100644
--- a/refs.c
+++ b/refs.c
@@ -3438,6 +3438,16 @@ int transaction_update_sha1(struct ref_transaction
*transaction
store for refs, such as a database.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 62 ++
1 file changed, 42 insertions(+), 20 deletions(-)
diff --git a/refs.c b/refs.c
index bcce8fe..829c89a 100644
--- a/refs.c
+++ b/refs.c
@@ -2633,6
We no longer need the function lock_any_ref_for_update so lets remove it.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 7 ---
refs.h | 4
2 files changed, 11 deletions(-)
diff --git a/refs.c b/refs.c
index 0cb4ae8..918cda3 100644
--- a/refs.c
+++ b/refs.c
@@ -2167,13 +2167,6 @@ static
x27;t need to do
anything at all in _commit than return failure.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/refs.c b/refs.c
index 8b09258..93f01e8 100644
--- a/refs.c
+++ b/refs.c
@@ -3558,6 +3558,9 @@ int transaction_commit(struct ref_transa
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
Signed-off-by: Ronnie Sahlberg
---
refs.c | 13 +++--
refs.h | 7 ---
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/refs.c b/refs.c
index aed700b..fe195dd 100644
--- a/refs.c
+++ b/refs.c
@@ -3354,17 +3354,10 @@ int ref_transaction_create(struct ref_transaction
We no longer need to expose the ref_lock structure to any external callers.
Make it private to refs.c.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 9 +
refs.h | 9 -
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/refs.c b/refs.c
index 918cda3..8129b20 100644
transaction */
transaction_update_sha1(t, ref, ...) /* will fail since ref was locked above */
Signed-off-by: Ronnie Sahlberg
---
refs.c | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/refs.c b/refs.c
index 87cdd91..17feec5 100644
--- a/refs.c
+++ b/refs.c
@@ -3325,6
We no longer need to export unlock_ref. Make the function static.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 20 ++--
refs.h | 3 ---
2 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/refs.c b/refs.c
index 17feec5..6933036 100644
--- a/refs.c
+++ b/refs.c
When deleting refs during a transaction, update the list of the refs to be
deleted already during _update instead of waiting until the _commit stage.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 16 +++-
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/refs.c b/refs.c
We no longer need to export close_ref. Make the function static.
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 6933036..a430b22 100644
--- a/refs.c
+++ b/refs.c
@@ -2668,7 +2668,7 @@ int
eck for
duplicates during _commit so all that code can be removed too.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 85 +-
1 file changed, 42 insertions(+), 43 deletions(-)
diff --git a/refs.c b/refs.c
index 93f01e8..76cab6e 100
Add a strbug argument to the update reflog transaction call so we can return
an error string back to the caller on failure.
Signed-off-by: Ronnie Sahlberg
---
builtin/reflog.c | 6 --
refs.c | 3 ++-
refs.h | 3 ++-
3 files changed, 8 insertions(+), 4 deletions(-)
diff
Track the names of the refs we are deleting in the ref_transaction structure
instead of building an array of names during _commit.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 35 +++
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/refs.c b/refs.c
such as this still fails:
update ref a c
update ref b b
update ref c c
Signed-off-by: Ronnie Sahlberg
---
refs.c| 23 +--
t/t1400-update-ref.sh | 23 +--
2 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/refs.c b/refs.c
Add a flag that allows us to truncate the reflog before we write the update.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 12 ++--
refs.h | 4 +++-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/refs.c b/refs.c
index d8a1568..a8b583a 100644
--- a/refs.c
+++ b/refs.c
Signed-off-by: Ronnie Sahlberg
---
refs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/refs.c b/refs.c
index 5a5f9df..58bbf1b 100644
--- a/refs.c
+++ b/refs.c
@@ -2707,6 +2707,7 @@ static int copy_msg(char *buf, const char *msg)
while (buf < cp && is
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
We no longer need to export commit_ref. Make the function static.
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 a430b22..0cb4ae8 100644
--- a/refs.c
+++ b/refs.c
@@ -2676,7 +2676,7 @@ static
ould break after the next patch).
Move these tests further down in the test to occur after we have created
refs/heads/a so that there is only one error condition in the test and that
we no longer depend on in which order the checks for error occur.
Signed-off-by: Ronnie Sahlberg
---
t/t1400-upd
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 3249576..8212d77 100644
--- a/refs.c
+++ b/refs.c
reflog.c has a transaction for updating the reflog. Use this transaction
also for locking the ref itself and updating the ref instead of
locking the file directly and writing to it. This now completely eliminates
the refs and reflog implementation from reflog.c.
Signed-off-by: Ronnie Sahlberg
similarly.
Signed-off-by: Ronnie Sahlberg
---
branch.c | 3 ++-
builtin/commit.c | 2 +-
builtin/fetch.c| 2 +-
builtin/receive-pack.c | 3 ++-
builtin/replace.c | 2 +-
builtin/tag.c | 2 +-
builtin/update-ref.c | 20
fast
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
Conflicts:
refs.h
---
refs.c | 107
backends
such as a TDB database.
Ronnie Sahlberg (31):
refs.c make ref_transaction_create a wrapper to ref_transaction_update
refs.c: make ref_transaction_delete a wrapper for
ref_transaction_update
refs.c: rename the transaction functions
refs.c: add a new update_type field to ref_update
Use a transaction when doing the updates of the reflog during expire_reflog.
Signed-off-by: Ronnie Sahlberg
---
builtin/reflog.c | 54 ++
refs.c | 4 ++--
2 files changed, 24 insertions(+), 34 deletions(-)
diff --git a/builtin
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 | 10 +++---
builtin/commit.c | 14
builtin/fetch.c| 10
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 | 11 +--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/refs.c b/refs.c
index 6785fa6..018062d
We want to allow to delete a ref even if it only exists as a packed ref
so we must tweak the REF_ISPACKONLY test in _update so it only applies
to the non-delete case.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 17 ++---
refs.h | 2 +-
2 files changed, 7 insertions(+), 12 deletions
On Wed, May 14, 2014 at 3:08 PM, Jonathan Nieder wrote:
> Hi,
>
> Ronnie Sahlberg wrote:
>
>> --- a/builtin/update-ref.c
>> +++ b/builtin/update-ref.c
>> @@ -342,6 +342,7 @@ int cmd_update_ref(int argc, const char **argv, const
>> char *prefix)
> [...]
>
On Wed, May 14, 2014 at 4:40 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
>> Update ref_transaction_update() do some basic error checking and return
>> true on error. Update all callers to check ref_transaction_update() for
>> error.
>> There are currently
On Wed, May 14, 2014 at 5:04 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
>> Do basic error checking in ref_transaction_create() and make it return
>> status. Update all callers to check the result of ref_transaction_create()
>> There are currently no conditi
On Wed, May 14, 2014 at 5:19 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
>> Change ref_transaction_delete() to do basic error checking and return
>> status. Update all callers to check the return for ref_transaction_delete()
>> There are currently no conditi
On Wed, May 14, 2014 at 5:27 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
>> --- a/builtin/tag.c
>> +++ b/builtin/tag.c
>> @@ -701,11 +702,12 @@ int cmd_tag(int argc, const char **argv, const char
>> *prefix)
>> if (annotate)
>>
On Wed, May 14, 2014 at 5:30 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
> [...]
>> +++ b/builtin/replace.c
> [...]
>> @@ -157,11 +158,12 @@ static int replace_object(const char *object_ref,
>> const char *replace_ref,
>> else if (!force)
&
On Wed, May 14, 2014 at 6:11 PM, Jonathan Nieder wrote:
> Ronnie Sahlberg wrote:
>
> [...]
>> +++ b/builtin/commit.c
>> @@ -1541,11 +1541,12 @@ int cmd_commit(int argc, const char **argv, const
>> char *prefix)
> [...]
>> @@ -1667,16 +1668,6 @@ int cmd_commi
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 a problem in repack_without_refs.
Signed-off-by: Ronnie Sahlberg
ref_transaction_update() in which case this change is required.
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 6898263..2114748 100644
--- a/refs.c
+++ b/refs.c
@@ -3338,7 +3338,8
Wrap all the ref updates inside a transaction to make the update atomic.
Signed-off-by: Ronnie Sahlberg
---
builtin/receive-pack.c | 20 ++--
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index c323081..d580176
We have to free the transaction before returning in the early check for
'return early if number of updates == 0' or else the following code would
create a memory leak with the transaction never being freed :
t = ref_transaction_begin()
ref_transaction_commit(t)
Signed-off-
unrelated ENOTDIR may cause us to return the wrong error. Clear errno before
calling any functions if we check errno afterwards.
Also skip initializing a static variable to 0. Statics live in .bss and
are all automatically initialized to 0.
Signed-off-by: Ronnie Sahlberg
---
builtin/fetch.c | 4
re correct, since if there was a problem
we would not even try to commit the transaction but need to highlight this
change in how/what errors are reported.
This change in what error is returned only occurs if there are multiple
refs that fail to update and only some, but not all, of them fail due
Change update_branch() to use ref transactions for updates.
Signed-off-by: Ronnie Sahlberg
---
fast-import.c | 22 ++
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 6707a66..79d219b 100644
--- a/fast-import.c
+++ b/fast
No external users call write_ref_sha1 any more so lets declare it static.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 4 +++-
refs.h | 3 ---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 82a8d4e..e5729ad 100644
--- a/refs.c
+++ b/refs.c
@@ -251,6 +251,8
Signed-off-by: Ronnie Sahlberg
---
fast-import.c | 17 -
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 3e356da..5587cf6 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1736,15 +1736,22 @@ static void dump_tags(void
Do basic error checking in ref_transaction_create() and make it return
non-zero on error. Update all callers to check the result of
ref_transaction_create(). There are currently no conditions in _create that
will return error but there will be in the future.
Signed-off-by: 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.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 30 ++
1 file changed, 6 insertions(+), 24 deletions
1 - 100 of 1143 matches
Mail list logo