aboutsummaryrefslogtreecommitdiff
path: root/refs/packed-backend.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2026-01-25 23:52:36 +0100
committerJunio C Hamano <gitster@pobox.com>2026-01-25 22:27:33 -0800
commitb52a28b03ec99f2cfe4ef921b0d47250c665b0c6 (patch)
tree80c65e8096138a107f3a00fd5b3b6faab5afd7a6 /refs/packed-backend.c
parent8745eae506f700657882b9e32b2aa00f234a6fb6 (diff)
downloadgit-b52a28b03ec99f2cfe4ef921b0d47250c665b0c6.tar.xz
refs: skip to next ref when current ref is rejected
In `refs_verify_refnames_available()` we have two nested loops: the outer loop iterates over all references to check, while the inner loop checks for filesystem conflicts for a given ref by breaking down its path. With batched updates, when we detect a filesystem conflict, we mark the update as rejected and execute 'continue'. However, this only skips to the next iteration of the inner loop, not the outer loop as intended. This causes the same reference to be repeatedly rejected. Fix this by using a goto statement to skip to the next reference in the outer loop. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs/packed-backend.c')
-rw-r--r--refs/packed-backend.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 4ea0c12299..59b3ecb9d6 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -1437,8 +1437,8 @@ static enum ref_transaction_error write_with_updates(struct packed_ref_store *re
update->refname);
ret = REF_TRANSACTION_ERROR_CREATE_EXISTS;
- if (ref_transaction_maybe_set_rejected(transaction, i, ret)) {
- strbuf_reset(err);
+ if (ref_transaction_maybe_set_rejected(transaction, i,
+ ret, err)) {
ret = 0;
continue;
}
@@ -1452,8 +1452,8 @@ static enum ref_transaction_error write_with_updates(struct packed_ref_store *re
oid_to_hex(&update->old_oid));
ret = REF_TRANSACTION_ERROR_INCORRECT_OLD_VALUE;
- if (ref_transaction_maybe_set_rejected(transaction, i, ret)) {
- strbuf_reset(err);
+ if (ref_transaction_maybe_set_rejected(transaction, i,
+ ret, err)) {
ret = 0;
continue;
}
@@ -1496,8 +1496,8 @@ static enum ref_transaction_error write_with_updates(struct packed_ref_store *re
oid_to_hex(&update->old_oid));
ret = REF_TRANSACTION_ERROR_NONEXISTENT_REF;
- if (ref_transaction_maybe_set_rejected(transaction, i, ret)) {
- strbuf_reset(err);
+ if (ref_transaction_maybe_set_rejected(transaction, i,
+ ret, err)) {
ret = 0;
continue;
}