Skip to content

Commit 133293a

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

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
@@ -1551,10 +1551,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
15511551
break;
15521552
case GIT_DIR_INVALID_OWNERSHIP:
15531553
if (!nongit_ok) {
1554+
struct strbuf prequoted = STRBUF_INIT;
15541555
struct strbuf quoted = STRBUF_INIT;
15551556

15561557
strbuf_complete(&report, '\n');
1557-
sq_quote_buf_pretty(&quoted, dir.buf);
1558+
1559+
#ifdef __MINGW32__
1560+
if (dir.buf[0] == '/')
1561+
strbuf_addstr(&prequoted, "%(prefix)/");
1562+
#endif
1563+
1564+
strbuf_add(&prequoted, dir.buf, dir.len);
1565+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1566+
15581567
die(_("detected dubious ownership in repository at '%s'\n"
15591568
"%s"
15601569
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)