@matheusbsbs / matheus-bagliano / commits / 1655707c9e
Fork 0

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>

Nicolas Pitre committed Jan 26, 2007 at 17:26 UTC 1655707c9ec56847945854f8645ed64f74159e99
2 files changed +3
refs.c
+2
@@ -680,6 +680,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *ref, const unsigned char
680 lock->lk = xcalloc(1, sizeof(struct lock_file));
681
682 lock->ref_name = xstrdup(ref);
683 + lock->orig_ref_name = xstrdup(orig_ref);
684 ref_file = git_path("%s", ref);
685 lock->force_write = lstat(ref_file, &st) && errno == ENOENT;
686
@@ -919,6 +920,7 @@ void unlock_ref(struct ref_lock *lock)
920 rollback_lock_file(lock->lk);
921 }
922 free(lock->ref_name);
923 + free(lock->orig_ref_name);
924 free(lock);
925 }
926
refs.h
+1
@@ -3,6 +3,7 @@
3
4 struct ref_lock {
5 char *ref_name;
6 + char *orig_ref_name;
7 struct lock_file *lk;
8 unsigned char old_sha1[20];
9 int lock_fd;