Skip to content

Commit 3903e5d

Browse files
derrickstoleemjcheetham
authored andcommitted
setup: properly use "%(prefix)/" when in WSL
Signed-off-by: Derrick Stolee <[email protected]>
1 parent 3f72192 commit 3903e5d

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
@@ -1635,10 +1635,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
16351635
break;
16361636
case GIT_DIR_INVALID_OWNERSHIP:
16371637
if (!nongit_ok) {
1638+
struct strbuf prequoted = STRBUF_INIT;
16381639
struct strbuf quoted = STRBUF_INIT;
16391640

16401641
strbuf_complete(&report, '\n');
1641-
sq_quote_buf_pretty(&quoted, dir.buf);
1642+
1643+
#ifdef __MINGW32__
1644+
if (dir.buf[0] == '/')
1645+
strbuf_addstr(&prequoted, "%(prefix)/");
1646+
#endif
1647+
1648+
strbuf_add(&prequoted, dir.buf, dir.len);
1649+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1650+
16421651
die(_("detected dubious ownership in repository at '%s'\n"
16431652
"%s"
16441653
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)