summaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2015-08-25 10:30:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-25 16:39:08 (GMT)
commit82fde87ff3be8d10854df18964e5816417a1d7cf (patch)
tree673846bd0ae86a2647ad95269572c2401a65d558 /setup.c
parenta17c56c056d5fea0843b429132904c429a900229 (diff)
downloadgit-82fde87ff3be8d10854df18964e5816417a1d7cf.zip
git-82fde87ff3be8d10854df18964e5816417a1d7cf.tar.gz
git-82fde87ff3be8d10854df18964e5816417a1d7cf.tar.bz2
setup: update the right file in multiple checkouts
This code is introduced in 23af91d (prune: strategies for linked checkouts - 2014-11-30), and it's supposed to implement this rule from that commit's message: - linked checkouts are supposed to keep its location in $R/gitdir up to date. The use case is auto fixup after a manual checkout move. Note the name, "$R/gitdir", not "$R/gitfile". Correct the path to be updated accordingly. While at there, make sure I/O errors are not silently dropped. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/setup.c b/setup.c
index 82c0cc2..465b42a 100644
--- a/setup.c
+++ b/setup.c
@@ -402,9 +402,9 @@ static void update_linked_gitdir(const char *gitfile, const char *gitdir)
struct strbuf path = STRBUF_INIT;
struct stat st;
- strbuf_addf(&path, "%s/gitfile", gitdir);
+ strbuf_addf(&path, "%s/gitdir", gitdir);
if (stat(path.buf, &st) || st.st_mtime + 24 * 3600 < time(NULL))
- write_file(path.buf, 0, "%s\n", gitfile);
+ write_file(path.buf, 1, "%s\n", gitfile);
strbuf_release(&path);
}