setup_git_directory(): handle UNC paths correctly
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 24 Aug 2019 22:10:44 +0000 (15:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Aug 2019 17:03:41 +0000 (10:03 -0700)
The first offset in a UNC path is not the host name, but the folder name after that.

This fixes https://github.com/git-for-windows/git/issues/1181

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
setup.c
diff --git a/setup.c b/setup.c
index 8dcb4631f7d330a290ab0bb6810f24999f65a1b7..bb039ee14d612afadbab2859856f70d7f24f66d9 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -919,7 +919,7 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
        const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
        struct string_list ceiling_dirs = STRING_LIST_INIT_DUP;
        const char *gitdirenv;
-       int ceil_offset = -1, min_offset = has_dos_drive_prefix(dir->buf) ? 3 : 1;
+       int ceil_offset = -1, min_offset = offset_1st_component(dir->buf);
        dev_t current_device = 0;
        int one_filesystem = 1;