Merge branch 'js/early-config'
authorJunio C Hamano <gitster@pobox.com>
Thu, 9 Nov 2017 05:31:29 +0000 (14:31 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Nov 2017 05:31:29 +0000 (14:31 +0900)
Correct start-up sequence so that a repository could be placed
immediately under the root directory again (which was broken at
around Git 2.13).

* js/early-config:
setup: avoid double slashes when looking for HEAD

setup.c
diff --git a/setup.c b/setup.c
index 03f51e056cd6e672ecd80ba94348173b9d496cc0..94768512b7913c4e46b90fc8226c183cbd7239d7 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -312,7 +312,9 @@ int is_git_directory(const char *suspect)
        size_t len;
 
        /* Check worktree-related signatures */
-       strbuf_addf(&path, "%s/HEAD", suspect);
+       strbuf_addstr(&path, suspect);
+       strbuf_complete(&path, '/');
+       strbuf_addstr(&path, "HEAD");
        if (validate_headref(path.buf))
                goto done;