Message ID | pull.1716.git.git.1714488648294.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | refs: return conflict error when checking packed refs | expand |
On Tue, Apr 30, 2024 at 02:50:47PM +0000, Ivan Tse via GitGitGadget wrote: > From: Ivan Tse <ivan.tse1@gmail.com> > > The TRANSACTION_NAME_CONFLICT error code refers to a failure to create a > ref due to a name conflict with another ref. An example of this is a > directory/file conflict such as ref names A/B and A. > > "git fetch" uses this error code to more accurately describe the error > by recommending to the user that they try running "git remote prune" to > remove any old refs that are deleted by the remote which would clear up > any directory/file conflicts. > > This helpful error message is not displayed when the conflicted ref is > stored in packed refs. This change fixes this by ensuring error return > code consistency in `lock_raw_ref`. The change itself makes sense to me. But I'd like to see a test that demonstrates the new behaviour so that we don't regress this in the future. Thanks! Patrick
diff --git a/refs/files-backend.c b/refs/files-backend.c index a098d14ea00..97473f377d1 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -794,8 +794,10 @@ static int lock_raw_ref(struct files_ref_store *refs, */ if (refs_verify_refname_available( refs->packed_ref_store, refname, - extras, NULL, err)) + extras, NULL, err)) { + ret = TRANSACTION_NAME_CONFLICT; goto error_return; + } } ret = 0;