Skip to content

Commit ebfff8f

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 17567e5 commit ebfff8f

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
@@ -1879,10 +1879,19 @@ const char *setup_git_directory_gently(int *nongit_ok)
18791879
break;
18801880
case GIT_DIR_INVALID_OWNERSHIP:
18811881
if (!nongit_ok) {
1882+
struct strbuf prequoted = STRBUF_INIT;
18821883
struct strbuf quoted = STRBUF_INIT;
18831884

18841885
strbuf_complete(&report, '\n');
1885-
sq_quote_buf_pretty(&quoted, dir.buf);
1886+
1887+
#ifdef __MINGW32__
1888+
if (dir.buf[0] == '/')
1889+
strbuf_addstr(&prequoted, "%(prefix)/");
1890+
#endif
1891+
1892+
strbuf_add(&prequoted, dir.buf, dir.len);
1893+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1894+
18861895
die(_("detected dubious ownership in repository at '%s'\n"
18871896
"%s"
18881897
"To add an exception for this directory, call:\n"

0 commit comments

Comments
 (0)