diff --git a/compat/mingw.c b/compat/mingw.c index 8c70f4e181..4b45ad2531 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -3037,9 +3037,7 @@ int is_path_owned_by_current_sid(const char *path) DACL_SECURITY_INFORMATION, &sid, NULL, NULL, NULL, &descriptor); - if (err != ERROR_SUCCESS) - error(_("failed to get owner for '%s' (%ld)"), path, err); - else if (sid && IsValidSid(sid)) { + if (err == ERROR_SUCCESS && sid && IsValidSid(sid)) { /* Now, verify that the SID matches the current user's */ static PSID current_user_sid; BOOL is_member; diff --git a/setup.c b/setup.c index c5ef2cc074..0a89bb7608 100644 --- a/setup.c +++ b/setup.c @@ -1432,6 +1432,7 @@ 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; struct strbuf hint = STRBUF_INIT; @@ -1444,7 +1445,14 @@ const char *setup_git_directory_gently(int *nongit_ok) "again for more information.")); #endif - 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(_("detected dubious ownership in repository at '%s'\n" "To add an exception for this directory, call:\n" "\n"