Skip to content

Commit 297bfa4

Browse files
derrickstoleeGit for Windows Build Agent
authored andcommitted
setup: properly use "%(prefix)/" when in WSL
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
1 parent 1b7f78d commit 297bfa4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

setup.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,10 +1956,19 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
19561956
break;
19571957
case GIT_DIR_INVALID_OWNERSHIP:
19581958
if (!nongit_ok) {
1959+
struct strbuf prequoted = STRBUF_INIT;
19591960
struct strbuf quoted = STRBUF_INIT;
19601961

19611962
strbuf_complete(&report, '\n');
1962-
sq_quote_buf_pretty(&quoted, dir.buf);
1963+
1964+
#ifdef __MINGW32__
1965+
if (dir.buf[0] == '/')
1966+
strbuf_addstr(&prequoted, "%(prefix)/");
1967+
#endif
1968+
1969+
strbuf_add(&prequoted, dir.buf, dir.len);
1970+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1971+
19631972
die(_("detected dubious ownership in repository at '%s'\n"
19641973
"%s"
19651974
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)