summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/setup.c b/setup.c
index bb039ee14d..a0cb42c235 100644
--- a/setup.c
+++ b/setup.c
@@ -947,6 +947,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>")