refs: on symref reflog expire, lock symref not referrent

When locking a symbolic ref to expire a reflog, lock the symbolic
ref (using REF_NODEREF) instead of its referent.

Add a test for this.

Signed-off-by: David Turner <dturner@twopensource.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
David Turner
2016-04-07 15:03:11 -04:00
committed by Junio C Hamano
parent 2d0663b216
commit 41d796ed5c
2 changed files with 12 additions and 1 deletions

View File

@ -3314,7 +3314,8 @@ int reflog_expire(const char *refname, const unsigned char *sha1,
* reference itself, plus we might need to update the
* reference if --updateref was specified:
*/
lock = lock_ref_sha1_basic(refname, sha1, NULL, NULL, 0, &type, &err);
lock = lock_ref_sha1_basic(refname, sha1, NULL, NULL, REF_NODEREF,
&type, &err);
if (!lock) {
error("cannot lock ref '%s': %s", refname, err.buf);
strbuf_release(&err);