Thread (134 messages) flat view 134 messages, 4 authors, 2016-06-15

Re: [PATCH v8 23/44] fetch.c: change s_update_ref to use a ref transaction

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

Ronnie Sahlberg wrote:
quoted hunk ↗ jump to hunk
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
[...]
quoted hunk ↗ jump to hunk
@@ -384,15 +384,16 @@ static int s_update_ref(const char *action,
 	snprintf(msg, sizeof(msg), "%s: %s", rla, action);
 
 	errno = 0;
-	lock = lock_any_ref_for_update(ref->name,
-				       check_old ? ref->old_sha1 : NULL,
-				       0, NULL);
-	if (!lock)
-		return errno == ENOTDIR ? STORE_REF_ERROR_DF_CONFLICT :
-					  STORE_REF_ERROR_OTHER;
-	if (write_ref_sha1(lock, ref->new_sha1, msg) < 0)
+	transaction = ref_transaction_begin();
+	if (!transaction ||
+	    ref_transaction_update(transaction, ref->name, ref->new_sha1,
+				   ref->old_sha1, 0, check_old) ||
+	    ref_transaction_commit(transaction, msg, NULL)) {
Since 'err' is NULL, does that mean there's no message shown to the
user on error?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help