Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat mount point as symlink-like in finddata2dirent #4383

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compat/win32/dirent.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static inline void finddata2dirent(struct dirent *ent, WIN32_FIND_DATAW *fdata)

/* Set file type, based on WIN32_FIND_DATA */
if ((fdata->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
&& fdata->dwReserved0 == IO_REPARSE_TAG_SYMLINK)
&& (fdata->dwReserved0 == IO_REPARSE_TAG_SYMLINK || fdata->dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks quite similar to https://github.com/git-for-windows/git/pull/437/files#diff-a6fe7e03ddc742e3276990c88327b92ce59fff378c1be07ed782f0096e131932L20-R21 therefore I suspect that the corresponding change to file_attr_to_st_mode() might be missing.

ent->d_type = DT_LNK;
else if (fdata->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
ent->d_type = DT_DIR;
Expand Down
22 changes: 22 additions & 0 deletions t/t7300-clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -799,4 +799,26 @@ test_expect_success MINGW 'clean does not traverse mount points' '
test_path_is_file target/dont-clean-me
'

test_expect_success MINGW 'clean handles recursive symlink' '
rm -fr repo &&
mkdir repo &&
(
cd repo &&
git init &&
mkdir -p packages/some-package/node_modules &&
cd packages/some-package &&
touch package.json &&
git add package.json &&
git commit -m setup &&
cd node_modules &&
cmd //c "mklink /D /J some-package .." &&
rimrul marked this conversation as resolved.
Show resolved Hide resolved
cd ../../.. &&
test_path_is_file packages/some-package/package.json &&
git clean -fdx packages 2>err &&
test_path_is_file packages/some-package/package.json &&
test_path_is_missing packages/some-package/node_modules &&
! test_i18ngrep "warning" err
)
'

test_done