Skip to content

Commit

Permalink
Enable gix-dir walk symlink tests even on Windows
Browse files Browse the repository at this point in the history
As detailed in d715e4a, most tests involving symlinks have been
expected to work even on Windows since #1444, but some tests remain
to be updated to be run on Windows or to include all
symlink-related asertions on Windows.

This includes 4 tests in `gix-dir/tests/walk/mod.rs`, which were
ignored on Windows even though they are able to pass. This commit
enables them on Windows. It also updates the associated fixture
scripts to no longer say that symlink test can't run on Windows.
But no changes to the fixture scripts are required for the tests to
pass.

(While doing so, I've made a small change, adding quoting to a here
document delimiter to make clear that no expansions are intended to
occur in the here document text. But this change is purely for
clarity; nothing was broken in connection with that heredoc.)
  • Loading branch information
EliahKagan committed Nov 4, 2024
1 parent d74e919 commit d03971b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
7 changes: 3 additions & 4 deletions gix-dir/tests/fixtures/many-symlinks.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env bash
set -eu -o pipefail

# Note that symlink creation fails on Windows for some reason,
# so these tests shouldn't be run there.
# These fixtures use symlinks. See `many.sh` for some that don't.

git init breakout-symlink
(cd breakout-symlink
Expand All @@ -20,7 +19,7 @@ git init immediate-breakout-symlink

git init excluded-symlinks-to-dir
(cd excluded-symlinks-to-dir
cat <<EOF >.gitignore
cat <<'EOF' >.gitignore
src1
src2/
file1
Expand All @@ -42,4 +41,4 @@ EOF
ln -s src/file file2
)

ln -s excluded-symlinks-to-dir worktree-root-is-symlink
ln -s excluded-symlinks-to-dir worktree-root-is-symlink
2 changes: 1 addition & 1 deletion gix-dir/tests/fixtures/many.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eu -o pipefail

# Nothing here may use symlinks so these fixtures can be used on windows as well.
# These fixtures don't use symlinks. See `many-symlinks.sh` for some that do.

git init with-nested-dot-git
(cd with-nested-dot-git
Expand Down
4 changes: 0 additions & 4 deletions gix-dir/tests/walk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use gix_dir::walk::ForDeletionMode;
use gix_ignore::Kind::*;

#[test]
#[cfg_attr(windows, ignore = "symlinks the way they are organized don't yet work on windows")]
fn symlink_to_dir_can_be_excluded() -> crate::Result {
let root = fixture_in("many-symlinks", "excluded-symlinks-to-dir");
let ((out, _root), entries) = collect(&root, None, |keep, ctx| {
Expand Down Expand Up @@ -94,7 +93,6 @@ fn symlink_to_dir_can_be_excluded() -> crate::Result {
}

#[test]
#[cfg_attr(windows, ignore = "symlinks the way they are organized don't yet work on windows")]
fn root_may_not_lead_through_symlinks() -> crate::Result {
for (name, intermediate, expected) in [
("immediate-breakout-symlink", "", 0),
Expand All @@ -121,7 +119,6 @@ fn root_may_not_lead_through_symlinks() -> crate::Result {
}

#[test]
#[cfg_attr(windows, ignore = "symlinks the way they are organized don't yet work on windows")]
fn root_may_be_a_symlink_if_it_is_the_worktree() -> crate::Result {
let root = fixture_in("many-symlinks", "worktree-root-is-symlink");
let ((_out, _root), entries) = collect(&root, None, |keep, ctx| {
Expand Down Expand Up @@ -2702,7 +2699,6 @@ fn decomposed_unicode_in_directory_is_returned_precomposed() -> crate::Result {
}

#[test]
#[cfg_attr(windows, ignore = "symlinks the way they are organized don't yet work on windows")]
fn worktree_root_can_be_symlink() -> crate::Result {
let root = fixture_in("many-symlinks", "symlink-to-breakout-symlink");
let troot = root.join("file");
Expand Down

0 comments on commit d03971b

Please sign in to comment.