Skip to content

Commit b1d2fea

Browse files
derrickstoleedscho
authored andcommitted
setup: properly use "%(prefix)/" when in WSL
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
1 parent c6ca5c1 commit b1d2fea

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: setup.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -1781,10 +1781,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
17811781
break;
17821782
case GIT_DIR_INVALID_OWNERSHIP:
17831783
if (!nongit_ok) {
1784+
struct strbuf prequoted = STRBUF_INIT;
17841785
struct strbuf quoted = STRBUF_INIT;
17851786

17861787
strbuf_complete(&report, '\n');
1787-
sq_quote_buf_pretty(&quoted, dir.buf);
1788+
1789+
#ifdef __MINGW32__
1790+
if (dir.buf[0] == '/')
1791+
strbuf_addstr(&prequoted, "%(prefix)/");
1792+
#endif
1793+
1794+
strbuf_add(&prequoted, dir.buf, dir.len);
1795+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1796+
17881797
die(_("detected dubious ownership in repository at '%s'\n"
17891798
"%s"
17901799
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)