Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v2 02/13] refs.c: use a single exit path from transaction commit and handle onerr

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:00:47
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Ronnie Sahlberg [off-list ref] writes:
quoted hunk
@@ -3481,6 +3481,14 @@ cleanup:
 			unlock_ref(updates[i]->lock);
 	free(delnames);
 	ref_transaction_free(transaction);
+	if (ret) {
+		const char *str = "Cannot commit transaction.";
+		switch (onerr) {
+		case UPDATE_REFS_MSG_ON_ERR: error(str); break;
+		case UPDATE_REFS_DIE_ON_ERR: die(str); break;
+		case UPDATE_REFS_QUIET_ON_ERR: break;
+		}
+	}
 	return ret;
 }
Also on top of this part:

 - avoid complier warning for printf-like functions getting a non
   literal format string as their format argument;

 - style: case label and each statement on its own line.

 - Allow localizing the error message.
diff --git a/refs.c b/refs.c
index e52b6bf..35ce61a 100644
--- a/refs.c
+++ b/refs.c
@@ -3515,11 +3515,16 @@ cleanup:
 	free(delnames);
 	ref_transaction_free(transaction);
 	if (ret) {
-		const char *str = "Cannot commit transaction.";
+		const char *str = _("Cannot commit transaction.");
 		switch (onerr) {
-		case UPDATE_REFS_MSG_ON_ERR: error(str); break;
-		case UPDATE_REFS_DIE_ON_ERR: die(str); break;
-		case UPDATE_REFS_QUIET_ON_ERR: break;
+		case UPDATE_REFS_MSG_ON_ERR:
+			error("%s", str);
+			break;
+		case UPDATE_REFS_DIE_ON_ERR:
+			die("%s", str);
+			break;
+		case UPDATE_REFS_QUIET_ON_ERR:
+			break;
 		}
 	}
 	return ret;
-- 
2.0.0-rc0-187-g5842ffa
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help