From: Nicolas Pitre Date: Fri, 26 Jan 2007 22:26:06 +0000 (-0500) Subject: lock_ref_sha1_basic(): remember the original name of a ref when resolving it X-Git-Tag: v1.5.0-rc4~49^2~11 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1655707c9ec56847945854f8645ed64f74159e99;p=git.git lock_ref_sha1_basic(): remember the original name of a ref when resolving it A ref might be pointing to another ref but only the name of the last ref is remembered. Let's remember about the first name as well. Signed-off-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- diff --git a/refs.c b/refs.c index 3b295f380..bd76ea65a 100644 --- a/refs.c +++ b/refs.c @@ -680,6 +680,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *ref, const unsigned char lock->lk = xcalloc(1, sizeof(struct lock_file)); lock->ref_name = xstrdup(ref); + lock->orig_ref_name = xstrdup(orig_ref); ref_file = git_path("%s", ref); lock->force_write = lstat(ref_file, &st) && errno == ENOENT; @@ -919,6 +920,7 @@ void unlock_ref(struct ref_lock *lock) rollback_lock_file(lock->lk); } free(lock->ref_name); + free(lock->orig_ref_name); free(lock); } diff --git a/refs.h b/refs.h index 2d2ba149a..94a58b41f 100644 --- a/refs.h +++ b/refs.h @@ -3,6 +3,7 @@ struct ref_lock { char *ref_name; + char *orig_ref_name; struct lock_file *lk; unsigned char old_sha1[20]; int lock_fd;