diff --git a/setup.c b/setup.c index a42b21307f7708..3f66dd5173ae03 100644 --- a/setup.c +++ b/setup.c @@ -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("ed, dir.buf); +#ifdef __MINGW32__ + if (dir.buf[0] == '/') + strbuf_addstr(&prequoted, "%(prefix)/"); +#endif + + strbuf_add(&prequoted, dir.buf, dir.len); + sq_quote_buf_pretty("ed, prequoted.buf); + die(_("unsafe repository ('%s' is owned by someone else)\n" "To add an exception for this directory, call:\n" "\n"