Skip to content

Commit 3011d30

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

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
@@ -1777,10 +1777,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
17771777
break;
17781778
case GIT_DIR_INVALID_OWNERSHIP:
17791779
if (!nongit_ok) {
1780+
struct strbuf prequoted = STRBUF_INIT;
17801781
struct strbuf quoted = STRBUF_INIT;
17811782

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

0 commit comments

Comments
 (0)