Ronnie Sahlberg <sahlb...@google.com> writes:

> @@ -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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to