Skip to content

Commit 16d77e2

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 e137f27 commit 16d77e2

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
@@ -1432,9 +1432,17 @@ const char *setup_git_directory_gently(int *nongit_ok)
14321432
break;
14331433
case GIT_DIR_INVALID_OWNERSHIP:
14341434
if (!nongit_ok) {
1435+
struct strbuf prequoted = STRBUF_INIT;
14351436
struct strbuf quoted = STRBUF_INIT;
14361437

1437-
sq_quote_buf_pretty(&quoted, dir.buf);
1438+
#ifdef __MINGW32__
1439+
if (dir.buf[0] == '/')
1440+
strbuf_addstr(&prequoted, "%(prefix)/");
1441+
#endif
1442+
1443+
strbuf_add(&prequoted, dir.buf, dir.len);
1444+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1445+
14381446
die(_("detected dubious ownership in repository at '%s'\n"
14391447
"To add an exception for this directory, call:\n"
14401448
"\n"

0 commit comments

Comments
 (0)