Skip to content

Commit 6021aa5

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

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
@@ -1780,10 +1780,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
17801780
break;
17811781
case GIT_DIR_INVALID_OWNERSHIP:
17821782
if (!nongit_ok) {
1783+
struct strbuf prequoted = STRBUF_INIT;
17831784
struct strbuf quoted = STRBUF_INIT;
17841785

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

0 commit comments

Comments
 (0)