Thread (89 messages) flat view 89 messages, 2 authors, 2016-06-15

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

From: Jonathan Nieder <hidden>
Date: 2016-06-15 23:01:26

Ronnie Sahlberg wrote:
Signed-off-by: Ronnie Sahlberg <redacted>
---
 refs.c | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)
Reviewed-by: Jonathan Nieder <redacted>

[...]
quoted hunk ↗ jump to hunk
+++ b/refs.c
[...]
quoted hunk ↗ jump to hunk
@@ -2542,24 +2537,21 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
 
 int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
 {
[...]
+	if (!transaction ||
+	    ref_transaction_delete(transaction, refname, sha1, delopt,
+				   sha1 && !is_null_sha1(sha1), &err) ||
+	    ref_transaction_commit(transaction, NULL, &err)) {
+		error("%s", err.buf);
+		ref_transaction_free(transaction);
+		strbuf_release(&err);
 		return 1;
+	}
[...]
-	ret |= repack_without_ref(lock->ref_name);
The old return value could be 1 or -1 depending on how the deletion
failed.  Now it's consistently 1.

The only callers I see that care are cmd_symbolic_ref and
cmd_update_ref, for which 1 is better (-1 would result in an exit
status of 255, which means something like "died with signal 127").

Thanks,
Jonathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help