Skip to content

Commit

Permalink
setup: properly use "%(prefix)/" when in WSL
Browse files Browse the repository at this point in the history
Signed-off-by: Derrick Stolee <[email protected]>
  • Loading branch information
derrickstolee committed Apr 13, 2022
1 parent fb104f7 commit 1d0b139
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1374,9 +1374,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"
Expand Down

0 comments on commit 1d0b139

Please sign in to comment.