diff options
| author | Ivan Tse <ivan.tse1@gmail.com> | 2024-05-04 03:04:08 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-06 08:48:25 -0700 |
| commit | 9339fca23efbe1a2f9dc916356be9d0a22d233c2 (patch) | |
| tree | aef4bf1541b26dac095766327be082d251908009 /refs/files-backend.c | |
| parent | 786a3e4b8d754d2b14b1208b98eeb0a554ef19a8 (diff) | |
refs: return conflict error when checking packed refs
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`.
Signed-off-by: Ivan Tse <ivan.tse1@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs/files-backend.c')
| -rw-r--r-- | refs/files-backend.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index a098d14ea0..97473f377d 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -794,8 +794,10 @@ retry: */ 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; |
