]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/update-ref.c
refs.c: remove the onerr argument to ref_transaction_commit
[thirdparty/git.git] / builtin / update-ref.c
index 405267f6e2776b3b2bf5c91c1102e090f5ac68f0..88ab785ea06118b9b84a73e2e0aa77f426e9b171 100644 (file)
@@ -342,6 +342,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
        const char *refname, *oldval, *msg = NULL;
        unsigned char sha1[20], oldsha1[20];
        int delete = 0, no_deref = 0, read_stdin = 0, end_null = 0, flags = 0;
+       struct strbuf err = STRBUF_INIT;
        struct option options[] = {
                OPT_STRING( 'm', NULL, &msg, N_("reason"), N_("reason of the update")),
                OPT_BOOL('d', NULL, &delete, N_("delete the reference")),
@@ -359,17 +360,16 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
                die("Refusing to perform update with empty message.");
 
        if (read_stdin) {
-               int ret;
                transaction = ref_transaction_begin();
-
                if (delete || no_deref || argc > 0)
                        usage_with_options(git_update_ref_usage, options);
                if (end_null)
                        line_termination = '\0';
                update_refs_stdin();
-               ret = ref_transaction_commit(transaction, msg,
-                                            UPDATE_REFS_DIE_ON_ERR);
-               return ret;
+               if (ref_transaction_commit(transaction, msg, &err))
+                       die("%s", err.buf);
+               ref_transaction_free(transaction);
+               return 0;
        }
 
        if (end_null)