diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-12-28 01:52:27 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-12-28 01:52:27 +0300 |
commit | deb67d12de91c0a8fecaee4c6a97f8f1e18b1c5a (patch) | |
tree | b6771dcfd7cc5f8118bfe2430a24b48d2df0a6fb /builtin | |
parent | a29e8b6059ca10f74f2f2412749edac18f88c466 (diff) | |
parent | 18ce48918cbbdc5091b57f4883f9fe3795b0ce44 (diff) |
Merge branch 'jx/fetch-atomic-error-message-fix'
"git fetch --atomic" issued an unnecessary empty error message,
which has been corrected.
* jx/fetch-atomic-error-message-fix:
fetch: no redundant error message for atomic fetch
t5574: test porcelain output of atomic fetch
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fetch.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index fd134ba74d..a284b970ef 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1651,7 +1651,7 @@ static int do_fetch(struct transport *transport, if (atomic_fetch) { transaction = ref_transaction_begin(&err); if (!transaction) { - retcode = error("%s", err.buf); + retcode = -1; goto cleanup; } } @@ -1711,7 +1711,6 @@ static int do_fetch(struct transport *transport, retcode = ref_transaction_commit(transaction, &err); if (retcode) { - error("%s", err.buf); ref_transaction_free(transaction); transaction = NULL; goto cleanup; @@ -1775,9 +1774,14 @@ static int do_fetch(struct transport *transport, } cleanup: - if (retcode && transaction) { - ref_transaction_abort(transaction, &err); - error("%s", err.buf); + if (retcode) { + if (err.len) { + error("%s", err.buf); + strbuf_reset(&err); + } + if (transaction && ref_transaction_abort(transaction, &err) && + err.len) + error("%s", err.buf); } display_state_release(&display_state); |