Skip to content

Commit 938a2c2

Browse files
derrickstoleedscho
authored andcommitted
compat/mingw.c: do not warn when failing to get owner
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 <[email protected]>
1 parent 768f423 commit 938a2c2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

compat/mingw.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -2723,9 +2723,7 @@ int is_path_owned_by_current_sid(const char *path, struct strbuf *report)
27232723
DACL_SECURITY_INFORMATION,
27242724
&sid, NULL, NULL, NULL, &descriptor);
27252725

2726-
if (err != ERROR_SUCCESS)
2727-
error(_("failed to get owner for '%s' (%ld)"), path, err);
2728-
else if (sid && IsValidSid(sid)) {
2726+
if (err == ERROR_SUCCESS && sid && IsValidSid(sid)) {
27292727
/* Now, verify that the SID matches the current user's */
27302728
static PSID current_user_sid;
27312729
BOOL is_member;

0 commit comments

Comments
 (0)