summaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2007-01-26 23:26:06 +0100
committerJunio C Hamano <junkio@cox.net>2007-01-28 11:16:46 +0100
commit1655707c9ec56847945854f8645ed64f74159e99 (patch)
treed9159101646d55b1d272aea8f09ac3af7638cd48 /refs.c
parentmake reflog filename independent from struct ref_lock (diff)
downloadgit-1655707c9ec56847945854f8645ed64f74159e99.tar.xz
git-1655707c9ec56847945854f8645ed64f74159e99.zip
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 <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index 3b295f3806..bd76ea65a9 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);
}