setup: properly use "%(prefix)/" when in WSL

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
This commit is contained in:
Derrick Stolee 2022-04-13 14:49:17 -04:00 коммит произвёл Johannes Schindelin
Родитель 5fe2bbe501
Коммит 620b06bd22
1 изменённых файлов: 9 добавлений и 1 удалений

10
setup.c
Просмотреть файл

@ -1383,9 +1383,17 @@ const char *setup_git_directory_gently(int *nongit_ok)
break;
case GIT_DIR_INVALID_OWNERSHIP:
if (!nongit_ok) {
struct strbuf prequoted = STRBUF_INIT;
struct strbuf quoted = STRBUF_INIT;
sq_quote_buf_pretty(&quoted, dir.buf);
#ifdef __MINGW32__
if (dir.buf[0] == '/')
strbuf_addstr(&prequoted, "%(prefix)/");
#endif
strbuf_add(&prequoted, dir.buf, dir.len);
sq_quote_buf_pretty(&quoted, prequoted.buf);
die(_("unsafe repository ('%s' is owned by someone else)\n"
"To add an exception for this directory, call:\n"
"\n"