Skip to content

Commit 9c88bfe

Browse files
derrickstoleeGit for Windows Build Agent
authored andcommitted
setup: properly use "%(prefix)/" when in WSL
Signed-off-by: Derrick Stolee <[email protected]>
1 parent 902cb5b commit 9c88bfe

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
@@ -1786,10 +1786,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
17861786
break;
17871787
case GIT_DIR_INVALID_OWNERSHIP:
17881788
if (!nongit_ok) {
1789+
struct strbuf prequoted = STRBUF_INIT;
17891790
struct strbuf quoted = STRBUF_INIT;
17901791

17911792
strbuf_complete(&report, '\n');
1792-
sq_quote_buf_pretty(&quoted, dir.buf);
1793+
1794+
#ifdef __MINGW32__
1795+
if (dir.buf[0] == '/')
1796+
strbuf_addstr(&prequoted, "%(prefix)/");
1797+
#endif
1798+
1799+
strbuf_add(&prequoted, dir.buf, dir.len);
1800+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1801+
17931802
die(_("detected dubious ownership in repository at '%s'\n"
17941803
"%s"
17951804
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)