Skip to content

Commit cdfdda1

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 c22dc42 commit cdfdda1

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
@@ -1782,10 +1782,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
17821782
break;
17831783
case GIT_DIR_INVALID_OWNERSHIP:
17841784
if (!nongit_ok) {
1785+
struct strbuf prequoted = STRBUF_INIT;
17851786
struct strbuf quoted = STRBUF_INIT;
17861787

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

0 commit comments

Comments
 (0)