Skip to content

Commit 9c2cdfe

Browse files
committed
[no-ci] Revert "WIP: mingw_stat(): handle symbolic links that point to directories"
This reverts commit 9b550e7 and reintroduces the breakage in t0060.221: [...] ++ chmod +x '/usr/src/git/t/trash directory.t0060-path-utils/bin/git-test-home' ++ echo 'echo mingw64' ++ write_script pretendmingw64/bin/git-test-bin ++ echo '#!/bin/sh' ++ cat ++ chmod +x pretendmingw64/bin/git-test-bin ++ echo 'echo usr' ++ write_script pretend/usr/bin/git-test-bin2 ++ echo '#!/bin/sh' ++ cat ++ chmod +x pretend/usr/bin/git-test-bin2 ++ MSYSTEM= ++ GIT_EXEC_PATH= ++ pretendmingw64/libexec/git-core/git.exe test-home ++ pretendmingw64/libexec/git-core/git.exe test-bin git: 'test-bin' is not a git command. See 'git --help'. error: last command exited with $?=1 not ok 221 - MSYSTEM/PATH is adjusted if necessary Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 9e44244 commit 9c2cdfe

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

compat/mingw.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,24 +1302,18 @@ int mingw_stat(const char *file_name, struct stat *buf)
13021302
if (hnd == INVALID_HANDLE_VALUE) {
13031303
DWORD err = GetLastError();
13041304

1305-
/* TODO: special-case existing reparse point and resolve manually if it is a directory */
1306-
if (err != ERROR_ACCESS_DENIED ||
1307-
(hnd = CreateFileW(wfile_name, 0,
1308-
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
1309-
NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) {
1310-
if (err == ERROR_ACCESS_DENIED &&
1311-
!mingw_lstat(file_name, buf) &&
1312-
!S_ISLNK(buf->st_mode))
1313-
/*
1314-
* POSIX semantics state to still try to fill
1315-
* information, even if permission is denied to create
1316-
* a file handle.
1317-
*/
1318-
return 0;
1305+
if (err == ERROR_ACCESS_DENIED &&
1306+
!mingw_lstat(file_name, buf) &&
1307+
!S_ISLNK(buf->st_mode))
1308+
/*
1309+
* POSIX semantics state to still try to fill
1310+
* information, even if permission is denied to create
1311+
* a file handle.
1312+
*/
1313+
return 0;
13191314

1320-
errno = err_win_to_posix(err);
1321-
return -1;
1322-
}
1315+
errno = err_win_to_posix(err);
1316+
return -1;
13231317
}
13241318
result = get_file_info_by_handle(hnd, buf);
13251319
CloseHandle(hnd);

0 commit comments

Comments
 (0)