Skip to content

Commit 8eb9bb2

Browse files
derrickstoleemjcheetham
authored andcommitted
setup: properly use "%(prefix)/" when in WSL
Signed-off-by: Derrick Stolee <[email protected]>
1 parent 69cd08b commit 8eb9bb2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

setup.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,10 +1490,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
14901490
break;
14911491
case GIT_DIR_INVALID_OWNERSHIP:
14921492
if (!nongit_ok) {
1493+
struct strbuf prequoted = STRBUF_INIT;
14931494
struct strbuf quoted = STRBUF_INIT;
14941495

14951496
strbuf_complete(&report, '\n');
1496-
sq_quote_buf_pretty(&quoted, dir.buf);
1497+
1498+
#ifdef __MINGW32__
1499+
if (dir.buf[0] == '/')
1500+
strbuf_addstr(&prequoted, "%(prefix)/");
1501+
#endif
1502+
1503+
strbuf_add(&prequoted, dir.buf, dir.len);
1504+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1505+
14971506
die(_("detected dubious ownership in repository at '%s'\n"
14981507
"%s"
14991508
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)