diff options
| author | Junio C Hamano <gitster@pobox.com> | 2017-10-11 14:52:23 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-10-11 14:52:23 +0900 |
| commit | bab02c6e63958fca62e197053f41affcd50bb00a (patch) | |
| tree | e87f179d6bad89e57dac5e1a2fe8df0380e0dc5d /refs.c | |
| parent | 3d2a6dc9362ec974002f585c30efa51609da0bf4 (diff) | |
| parent | a1c1d8170dbc4a108dd2c05d2f93049d49e61328 (diff) | |
| download | git-bab02c6e63958fca62e197053f41affcd50bb00a.tar.xz | |
Merge branch 'jk/refs-df-conflict'
An ancient bug that made Git misbehave with creation/renaming of
refs has been fixed.
* jk/refs-df-conflict:
refs_resolve_ref_unsafe: handle d/f conflicts for writes
t3308: create a real ref directory/file conflict
Diffstat (limited to 'refs.c')
| -rw-r--r-- | refs.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1435,8 +1435,21 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs, if (refs_read_raw_ref(refs, refname, sha1, &sb_refname, &read_flags)) { *flags |= read_flags; - if (errno != ENOENT || (resolve_flags & RESOLVE_REF_READING)) + + /* In reading mode, refs must eventually resolve */ + if (resolve_flags & RESOLVE_REF_READING) + return NULL; + + /* + * Otherwise a missing ref is OK. But the files backend + * may show errors besides ENOENT if there are + * similarly-named refs. + */ + if (errno != ENOENT && + errno != EISDIR && + errno != ENOTDIR) return NULL; + hashclr(sha1); if (*flags & REF_BAD_NAME) *flags |= REF_ISBROKEN; |
