aboutsummaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-09-29 11:40:35 -0700
committerJunio C Hamano <gitster@pobox.com>2025-09-29 11:40:35 -0700
commit96ed0a89066c2ea57c18b6586b2cab2edc333515 (patch)
tree0c169b6991d043f9fdc549b02f345809eb655f4f /refs.c
parentMerge branch 'jk/color-variable-fixes' (diff)
parentrefs/files: handle D/F conflicts during locking (diff)
downloadgit-96ed0a89066c2ea57c18b6586b2cab2edc333515.tar.gz
git-96ed0a89066c2ea57c18b6586b2cab2edc333515.zip
Merge branch 'kn/refs-files-case-insensitive'
Deal more gracefully with directory / file conflicts when the files backend is used for ref storage, by failing only the ones that are involved in the conflict while allowing others. * kn/refs-files-case-insensitive: refs/files: handle D/F conflicts during locking refs/files: handle F/D conflicts in case-insensitive FS refs/files: use correct error type when lock exists refs/files: catch conflicts on case-insensitive file-systems
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index f15366bfce..c164374c26 100644
--- a/refs.c
+++ b/refs.c
@@ -1237,7 +1237,7 @@ int ref_transaction_maybe_set_rejected(struct ref_transaction *transaction,
return 0;
if (!transaction->rejections)
- BUG("transaction not inititalized with failure support");
+ BUG("transaction not initialized with failure support");
/*
* Don't accept generic errors, since these errors are not user
@@ -1246,6 +1246,13 @@ int ref_transaction_maybe_set_rejected(struct ref_transaction *transaction,
if (err == REF_TRANSACTION_ERROR_GENERIC)
return 0;
+ /*
+ * Rejected refnames shouldn't be considered in the availability
+ * checks, so remove them from the list.
+ */
+ string_list_remove(&transaction->refnames,
+ transaction->updates[update_idx]->refname, 0);
+
transaction->updates[update_idx]->rejection_err = err;
ALLOC_GROW(transaction->rejections->update_indices,
transaction->rejections->nr + 1,
@@ -3330,6 +3337,8 @@ const char *ref_transaction_error_msg(enum ref_transaction_error err)
return "invalid new value provided";
case REF_TRANSACTION_ERROR_EXPECTED_SYMREF:
return "expected symref but found regular ref";
+ case REF_TRANSACTION_ERROR_CASE_CONFLICT:
+ return "reference conflict due to case-insensitive filesystem";
default:
return "unknown failure";
}