From: Nicolas Pitre Date: Fri, 26 Jan 2007 22:26:07 GMT Subject: [PATCH 3/7] enable separate reflog for HEAD Message-ID: <11698503712998-git-send-email-nico@cam.org> In-Reply-To: <11698503712588-git-send-email-nico@cam.org> If HEAD is tied to a branch then both logs/HEAD and logs/heads/ 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 --- refs.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index 9641fad..92fa2e4 100644 --- a/refs.c +++ b/refs.c @@ -935,7 +935,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); @@ -1005,7 +1006,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; } -- 1.5.0.rc2.g6e2c