Skip to content

Commit e131cec

Browse files
derrickstoleedscho
authored andcommitted
setup: properly use "%(prefix)/" when in WSL
Signed-off-by: Derrick Stolee <[email protected]>
1 parent c3fcb3b commit e131cec

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
@@ -1374,9 +1374,17 @@ const char *setup_git_directory_gently(int *nongit_ok)
13741374
break;
13751375
case GIT_DIR_INVALID_OWNERSHIP:
13761376
if (!nongit_ok) {
1377+
struct strbuf prequoted = STRBUF_INIT;
13771378
struct strbuf quoted = STRBUF_INIT;
13781379

1379-
sq_quote_buf_pretty(&quoted, dir.buf);
1380+
#ifdef __MINGW32__
1381+
if (dir.buf[0] == '/')
1382+
strbuf_addstr(&prequoted, "%(prefix)/");
1383+
#endif
1384+
1385+
strbuf_add(&prequoted, dir.buf, dir.len);
1386+
sq_quote_buf_pretty(&quoted, prequoted.buf);
1387+
13801388
die(_("unsafe repository ('%s' is owned by someone else)\n"
13811389
"To add an exception for this directory, call:\n"
13821390
"\n"

0 commit comments

Comments
 (0)