Skip to content

Commit a90c7df

Browse files
derrickstoleeGit for Windows Build Agent
authored andcommitted
setup: properly use "%(prefix)/" when in WSL
Signed-off-by: Derrick Stolee <[email protected]>
1 parent 4f0d1d6 commit a90c7df

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

setup.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
14791479
break;
14801480
case GIT_DIR_INVALID_OWNERSHIP:
14811481
if (!nongit_ok) {
1482+
struct strbuf prequoted = STRBUF_INIT;
14821483
struct strbuf quoted = STRBUF_INIT;
14831484
struct strbuf hint = STRBUF_INIT;
14841485

@@ -1491,7 +1492,14 @@ const char *setup_git_directory_gently(int *nongit_ok)
14911492
"again for more information."));
14921493
#endif
14931494

1494-
sq_quote_buf_pretty(&quoted, dir.buf);
1495+
#ifdef __MINGW32__
1496+
if (dir.buf[0] == '/')
1497+
strbuf_addstr(&prequoted, "%(prefix)/");
1498+
#endif
1499+
1500+
strbuf_add(&prequoted, dir.buf, dir.len);
1501+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1502+
14951503
die(_("detected dubious ownership in repository at '%s'\n"
14961504
"To add an exception for this directory, call:\n"
14971505
"\n"

0 commit comments

Comments
 (0)