Skip to content

Commit

Permalink
compat/mingw.c: do not warn when failing to get owner
Browse files Browse the repository at this point in the history
In the case of Git for Windows (say, in a Git Bash window) running in a
Windows Subsystem for Linux (WSL) directory, the GetNamedSecurityInfoW()
call in is_path_owned_By_current_side() returns an error code other than
ERROR_SUCCESS. This is consistent behavior across this boundary.

In these cases, the owner would always be different because the WSL
owner is a different entity than the Windows user.

The change here is to suppress the error message that looks like this:

  error: failed to get owner for '//wsl.localhost/...' (1)

Before this change, this warning happens for every Git command,
regardless of whether the directory is marked with safe.directory.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
  • Loading branch information
derrickstolee authored and dscho committed Sep 22, 2022
1 parent b126552 commit ec68459
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions compat/mingw.c
Expand Up @@ -2720,9 +2720,7 @@ int is_path_owned_by_current_sid(const char *path, struct strbuf *report)
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;
Expand Down

0 comments on commit ec68459

Please sign in to comment.