Skip to content

Commit 1c37c54

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

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
@@ -1506,10 +1506,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
15061506
break;
15071507
case GIT_DIR_INVALID_OWNERSHIP:
15081508
if (!nongit_ok) {
1509+
struct strbuf prequoted = STRBUF_INIT;
15091510
struct strbuf quoted = STRBUF_INIT;
15101511

15111512
strbuf_complete(&report, '\n');
1512-
sq_quote_buf_pretty(&quoted, dir.buf);
1513+
1514+
#ifdef __MINGW32__
1515+
if (dir.buf[0] == '/')
1516+
strbuf_addstr(&prequoted, "%(prefix)/");
1517+
#endif
1518+
1519+
strbuf_add(&prequoted, dir.buf, dir.len);
1520+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1521+
15131522
die(_("detected dubious ownership in repository at '%s'\n"
15141523
"%s"
15151524
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)