Skip to content

Commit 8afd3ea

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

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
@@ -1573,10 +1573,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
15731573
break;
15741574
case GIT_DIR_INVALID_OWNERSHIP:
15751575
if (!nongit_ok) {
1576+
struct strbuf prequoted = STRBUF_INIT;
15761577
struct strbuf quoted = STRBUF_INIT;
15771578

15781579
strbuf_complete(&report, '\n');
1579-
sq_quote_buf_pretty(&quoted, dir.buf);
1580+
1581+
#ifdef __MINGW32__
1582+
if (dir.buf[0] == '/')
1583+
strbuf_addstr(&prequoted, "%(prefix)/");
1584+
#endif
1585+
1586+
strbuf_add(&prequoted, dir.buf, dir.len);
1587+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1588+
15801589
die(_("detected dubious ownership in repository at '%s'\n"
15811590
"%s"
15821591
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)