Message ID | e27a58d363c11c941a1e7b921dae8487a9d062df.1566684643.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Handle worktrees at the top of a network drive | expand |
diff --git a/setup.c b/setup.c index a803b3ade3..3d24de15dd 100644 --- a/setup.c +++ b/setup.c @@ -934,6 +934,12 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir, if (ceil_offset < 0) ceil_offset = min_offset - 2; + if (min_offset && min_offset == dir->len && + !is_dir_sep(dir->buf[min_offset - 1])) { + strbuf_addch(dir, '/'); + min_offset++; + } + /* * Test in the following order (relative to the dir): * - .git (file containing "gitdir: <path>")