Skip to content

Commit e392645

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

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
@@ -1493,10 +1493,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
14931493
break;
14941494
case GIT_DIR_INVALID_OWNERSHIP:
14951495
if (!nongit_ok) {
1496+
struct strbuf prequoted = STRBUF_INIT;
14961497
struct strbuf quoted = STRBUF_INIT;
14971498

14981499
strbuf_complete(&report, '\n');
1499-
sq_quote_buf_pretty(&quoted, dir.buf);
1500+
1501+
#ifdef __MINGW32__
1502+
if (dir.buf[0] == '/')
1503+
strbuf_addstr(&prequoted, "%(prefix)/");
1504+
#endif
1505+
1506+
strbuf_add(&prequoted, dir.buf, dir.len);
1507+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1508+
15001509
die(_("detected dubious ownership in repository at '%s'\n"
15011510
"%s"
15021511
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)