Skip to content

Commit 4a8671d

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 89954f8 commit 4a8671d

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,9 +1479,17 @@ 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

1484-
sq_quote_buf_pretty(&quoted, dir.buf);
1485+
#ifdef __MINGW32__
1486+
if (dir.buf[0] == '/')
1487+
strbuf_addstr(&prequoted, "%(prefix)/");
1488+
#endif
1489+
1490+
strbuf_add(&prequoted, dir.buf, dir.len);
1491+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1492+
14851493
die(_("detected dubious ownership in repository at '%s'\n"
14861494
"To add an exception for this directory, call:\n"
14871495
"\n"

0 commit comments

Comments
 (0)