diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-12-27 14:52:27 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-12-27 14:52:27 -0800 |
| commit | deb67d12de91c0a8fecaee4c6a97f8f1e18b1c5a (patch) | |
| tree | b6771dcfd7cc5f8118bfe2430a24b48d2df0a6fb /builtin/fetch.c | |
| parent | Merge branch 'rs/c99-stdbool-test-balloon' (diff) | |
| parent | fetch: no redundant error message for atomic fetch (diff) | |
| download | git-deb67d12de91c0a8fecaee4c6a97f8f1e18b1c5a.tar.gz git-deb67d12de91c0a8fecaee4c6a97f8f1e18b1c5a.zip | |
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/fetch.c')
| -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); |
