aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2007-01-26 17:26:07 -0500
committerJunio C Hamano <junkio@cox.net>2007-01-28 02:16:46 -0800
commitbd104db164d7f2a714aa0f1cdf89fd89fee6c00a (patch)
tree587094c19bd9b1a9e90c2085a5929dc10c50c8a6
parent1655707c9ec56847945854f8645ed64f74159e99 (diff)
downloadgit-bd104db164d7f2a714aa0f1cdf89fd89fee6c00a.tar.gz
git-bd104db164d7f2a714aa0f1cdf89fd89fee6c00a.tar.xz
enable separate reflog for HEAD
If HEAD is tied to a branch then both logs/HEAD and logs/heads/<branch> are updated. This is also true for any symbolic refs in general, but only HEAD will see its reflog created automatically. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--refs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index bd76ea65a..5b2ca086a 100644
--- a/refs.c
+++ b/refs.c
@@ -940,7 +940,8 @@ static int log_ref_write(const char *ref_name, const unsigned char *old_sha1,
if (log_all_ref_updates &&
(!strncmp(ref_name, "refs/heads/", 11) ||
- !strncmp(ref_name, "refs/remotes/", 13))) {
+ !strncmp(ref_name, "refs/remotes/", 13) ||
+ !strcmp(ref_name, "HEAD"))) {
if (safe_create_leading_directories(log_file) < 0)
return error("unable to create directory for %s",
log_file);
@@ -1016,7 +1017,9 @@ int write_ref_sha1(struct ref_lock *lock,
return -1;
}
invalidate_cached_refs();
- if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0) {
+ if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
+ (strcmp(lock->ref_name, lock->orig_ref_name) &&
+ log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
unlock_ref(lock);
return -1;
}