From: Junio C Hamano Date: Tue, 27 Nov 2012 21:28:45 +0000 (-0800) Subject: Merge branch 'jh/update-ref-d-through-symref' into maint X-Git-Tag: v1.8.1-rc0~24^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ed20513c8de70e8bd7f18d2fb5beb1a81f49cdf8?hp=-c Merge branch 'jh/update-ref-d-through-symref' into maint * jh/update-ref-d-through-symref: Fix failure to delete a packed ref through a symref t1400-update-ref: Add test verifying bug with symrefs in delete_ref() --- ed20513c8de70e8bd7f18d2fb5beb1a81f49cdf8 diff --combined refs.c index 9d1685bcba,b4c57af998..520e50f3bc --- a/refs.c +++ b/refs.c @@@ -1753,24 -1753,32 +1753,24 @@@ int delete_ref(const char *refname, con struct ref_lock *lock; int err, i = 0, ret = 0, flag = 0; - lock = lock_ref_sha1_basic(refname, sha1, 0, &flag); + lock = lock_ref_sha1_basic(refname, sha1, delopt, &flag); if (!lock) return 1; if (!(flag & REF_ISPACKED) || flag & REF_ISSYMREF) { /* loose */ - const char *path; - - if (!(delopt & REF_NODEREF)) { - i = strlen(lock->lk->filename) - 5; /* .lock */ - lock->lk->filename[i] = 0; - path = lock->lk->filename; - } else { - path = git_path("%s", refname); - } - err = unlink_or_warn(path); + i = strlen(lock->lk->filename) - 5; /* .lock */ + lock->lk->filename[i] = 0; + err = unlink_or_warn(lock->lk->filename); if (err && errno != ENOENT) ret = 1; - if (!(delopt & REF_NODEREF)) - lock->lk->filename[i] = '.'; + lock->lk->filename[i] = '.'; } /* removing the loose one could have resurrected an earlier * packed one. Also, if it was not loose we need to repack * without it. */ - ret |= repack_without_ref(refname); + ret |= repack_without_ref(lock->ref_name); unlink_or_warn(git_path("logs/%s", lock->ref_name)); invalidate_ref_cache(NULL);