Skip to content

Commit

Permalink
working_copy: don't follow symlinks when visiting files in gitignored…
Browse files Browse the repository at this point in the history
… directory

Fixes #2878
  • Loading branch information
yuja committed Jan 24, 2024
1 parent d0d4496 commit 5a7d8ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/src/local_working_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions lib/tests/test_local_working_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down

0 comments on commit 5a7d8ac

Please sign in to comment.