working_copy: don't follow symlinks when visiting files in gitignored directory

Fixes #2878
This commit is contained in:
Yuya Nishihara 2024-01-24 12:29:33 +09:00
parent d0d4496258
commit 5a7d8ac596
3 changed files with 4 additions and 3 deletions

View file

@ -37,6 +37,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed bugs
* Fixed snapshots of symlinks in `gitignore`-d directory.
[#2878](https://github.com/martinvonz/jj/issues/2878)
## [0.13.0] - 2024-01-03

View file

@ -894,7 +894,7 @@ impl TreeState {
continue;
}
let disk_path = tracked_path.to_fs_path(&self.working_copy_path);
let metadata = match disk_path.metadata() {
let metadata = match disk_path.symlink_metadata() {
Ok(metadata) => metadata,
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
continue;

View file

@ -836,9 +836,7 @@ fn test_gitignores_ignored_directory_already_tracked() {
(modified_normal_path, Kind::Normal, "modified"),
(unchanged_executable_path, Kind::Executable, "contents"),
(modified_executable_path, Kind::Executable, "modified"),
#[cfg(not(unix))] // TODO
(unchanged_symlink_path, Kind::Symlink, "contents"),
#[cfg(not(unix))] // TODO
(modified_symlink_path, Kind::Symlink, "modified"),
]);
assert_eq!(