Skip to content

Commit de38b14

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 06d1fb1 commit de38b14

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
@@ -1784,10 +1784,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
17841784
break;
17851785
case GIT_DIR_INVALID_OWNERSHIP:
17861786
if (!nongit_ok) {
1787+
struct strbuf prequoted = STRBUF_INIT;
17871788
struct strbuf quoted = STRBUF_INIT;
17881789

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

0 commit comments

Comments
 (0)