summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-07-13 11:50:45 +0700
committerJunio C Hamano <gitster@pobox.com>2014-07-13 18:26:53 -0700
commit4127719f656a3bcaad127cd84d2b5f37710bedab (patch)
treee29c082a14f06a27a2cda92ae3aff378d577e4cd
parenta69bfb8bb51ff1f94921e25b4ac241418967d816 (diff)
downloadgit-4127719f656a3bcaad127cd84d2b5f37710bedab.tar.gz
reflog: avoid constructing .lock path with git_path
Among pathnames in $GIT_DIR, e.g. "index" or "packed-refs", we want to automatically and silently map some of them to the $GIT_DIR of the repository we are borrowing from via $GIT_COMMON_DIR mechanism. When we formulate the pathname for its lockfile, we want it to be in the same location as its final destination. "index" is not shared and needs to remain in the borrowing repository, while "packed-refs" is shared and needs to go to the borrowed repository. git_path() could be taught about the ".lock" suffix and map "index.lock" and "packed-refs.lock" the same way their basenames are mapped, but instead the caller can help by asking where the basename (e.g. "index") is mapped to git_path() and then appending ".lock" after the mapping is done. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/reflog.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/reflog.c b/builtin/reflog.c
index e8a8fb13b9..9bd874d070 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -372,7 +372,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
if (!reflog_exists(ref))
goto finish;
if (!cmd->dry_run) {
- newlog_path = git_pathdup("logs/%s.lock", ref);
+ newlog_path = mkpathdup("%s.lock", log_file);
cb.newlog = fopen(newlog_path, "w");
}