Skip to content

Commit 768f423

Browse files
derrickstoleedscho
authored andcommitted
setup: properly use "%(prefix)/" when in WSL
Signed-off-by: Derrick Stolee <[email protected]>
1 parent 787bfe4 commit 768f423

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

setup.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -1482,10 +1482,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
14821482
break;
14831483
case GIT_DIR_INVALID_OWNERSHIP:
14841484
if (!nongit_ok) {
1485+
struct strbuf prequoted = STRBUF_INIT;
14851486
struct strbuf quoted = STRBUF_INIT;
14861487

14871488
strbuf_complete(&report, '\n');
1488-
sq_quote_buf_pretty(&quoted, dir.buf);
1489+
1490+
#ifdef __MINGW32__
1491+
if (dir.buf[0] == '/')
1492+
strbuf_addstr(&prequoted, "%(prefix)/");
1493+
#endif
1494+
1495+
strbuf_add(&prequoted, dir.buf, dir.len);
1496+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1497+
14891498
die(_("detected dubious ownership in repository at '%s'\n"
14901499
"%s"
14911500
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)