Skip to content

Commit 4cf8405

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

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
@@ -1789,10 +1789,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
17891789
break;
17901790
case GIT_DIR_INVALID_OWNERSHIP:
17911791
if (!nongit_ok) {
1792+
struct strbuf prequoted = STRBUF_INIT;
17921793
struct strbuf quoted = STRBUF_INIT;
17931794

17941795
strbuf_complete(&report, '\n');
1795-
sq_quote_buf_pretty(&quoted, dir.buf);
1796+
1797+
#ifdef __MINGW32__
1798+
if (dir.buf[0] == '/')
1799+
strbuf_addstr(&prequoted, "%(prefix)/");
1800+
#endif
1801+
1802+
strbuf_add(&prequoted, dir.buf, dir.len);
1803+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1804+
17961805
die(_("detected dubious ownership in repository at '%s'\n"
17971806
"%s"
17981807
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)