Skip to content

Commit 1023670

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

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
@@ -1671,10 +1671,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
16711671
break;
16721672
case GIT_DIR_INVALID_OWNERSHIP:
16731673
if (!nongit_ok) {
1674+
struct strbuf prequoted = STRBUF_INIT;
16741675
struct strbuf quoted = STRBUF_INIT;
16751676

16761677
strbuf_complete(&report, '\n');
1677-
sq_quote_buf_pretty(&quoted, dir.buf);
1678+
1679+
#ifdef __MINGW32__
1680+
if (dir.buf[0] == '/')
1681+
strbuf_addstr(&prequoted, "%(prefix)/");
1682+
#endif
1683+
1684+
strbuf_add(&prequoted, dir.buf, dir.len);
1685+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1686+
16781687
die(_("detected dubious ownership in repository at '%s'\n"
16791688
"%s"
16801689
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)