Merge branch 'nd/fixup-linked-gitdir'
authorJunio C Hamano <gitster@pobox.com>
Tue, 1 Sep 2015 23:31:06 +0000 (16:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 1 Sep 2015 23:31:07 +0000 (16:31 -0700)
The code in "multiple-worktree" support that attempted to recover
from an inconsistent state updated an incorrect file.

* nd/fixup-linked-gitdir:
setup: update the right file in multiple checkouts

1  2 
setup.c
diff --cc setup.c
index a206781d58d535887be3f8a86bfda56c5d119d95,465b42a1d7aecc3991c9dd2c592d8fa164ba545e..a17c51e61d75ac8280bf04d95c50d7bdfd6d7a0e
+++ b/setup.c
@@@ -402,9 -402,9 +402,9 @@@ static void update_linked_gitdir(const 
        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_gently(path.buf, "%s", gitfile);
 -              write_file(path.buf, 1, "%s\n", gitfile);
++              write_file(path.buf, "%s", gitfile);
        strbuf_release(&path);
  }