You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set +x in index in gix-archive basic fixture, adjust tests
As far as I know, gix-archive has no limitations related to Unix
executable bits, on any platform. On Windows, the *filesystem* does
not support these, and `chmod +x` commands in fixtures run in Git
Bash appear to succeed but actually have no effect. But +x metadata
can be staged and committed in Git repositories. When that is done,
gix-archive can use those metadata just as it does on a Unix-like
system.
This fixes the tests to reflect this ability. Changes:
1. Add a `git update-index --chmod=+x` command to the gix-archive
`basic.sh` fixture for `dir/subdir/exe`, so that even if the
`chmod +x` command has no effect, the executable bit is set.
This only affects `dir/subdir/exe`. It does not affect
`extra-exe`, since that is never staged. On Windows, `extra-exe`
can never have any associated executable mode bits.
2. Update the `basic_usage_internal` test to assert that
`dir/subdir/exe` is `EntryKind::BlobExecutable` on all
platforms, i.e., no longer `EntryKind::Blob` on Windows.
Without this change, the change in (1) causes the test to fail.
This also refactors to remove the `expected_exe_mode` constant,
since its value is now only used in one place (for `extra-exe`),
and to remove `expected_link_mode`, which has unconditionally
been another name for `EntryKind::Link` since 93e088a (GitoxideLabs#1444).
3. Update the `basic_usage_tar` test to assert that the mode stored
for `prefix/dir/subdir/exe` is 493 (0o755) on all platforms,
i.e., no longer 420 (0o644) on Windows.
This is analogous to (2), and without this the `basic_usage_tar`
test fails due to the changes in (1). As in (2), this includes
refactoring: `expected_exe_mode` is removed now that the choice
between 420 (0o644) and 493 (0o755) is only made in one place
(for `prefix/extra-exe`), and `expected_symlink_type` is
removed, since it has unconditionally been another name for
`EntryType::Symlink` since 93e088a (GitoxideLabs#1444).
For future reference, with (1) but before (2), the failure is:
--- STDERR: gix-archive::archive from_tree::basic_usage_internal ---
Archive at 'tests\fixtures\generated-archives\basic.tar' not found, creating fixture using script 'basic.sh'
thread 'from_tree::basic_usage_internal' panicked at gix-archive\tests\archive.rs:36:13:
assertion `left == right` failed
left: [(".gitattributes", Blob, Sha1(45c160c35c17ad264b96431cceb9793160396e99)), ("a", Blob, Sha1(45b983be36b73c0788dc9cbcb76cbb80fc7bb057)), ("symlink-to-a", Link, Sha1(2e65efe2a145dda7ee51d1741299f848e5bf752e)), ("dir/b", Blob, Sha1(ab4a98190cf776b43cb0fe57cef231fb93fd07e6)), ("dir/subdir/exe", BlobExecutable, Sha1(e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)), ("extra-file", Blob, Sha1(0000000000000000000000000000000000000000)), ("extra-exe", Blob, Sha1(0000000000000000000000000000000000000000)), ("extra-dir-empty", Tree, Sha1(0000000000000000000000000000000000000000)), ("extra-dir/symlink-to-extra", Link, Sha1(0000000000000000000000000000000000000000))]
right: [(".gitattributes", Blob, Sha1(45c160c35c17ad264b96431cceb9793160396e99)), ("a", Blob, Sha1(45b983be36b73c0788dc9cbcb76cbb80fc7bb057)), ("symlink-to-a", Link, Sha1(2e65efe2a145dda7ee51d1741299f848e5bf752e)), ("dir/b", Blob, Sha1(ab4a98190cf776b43cb0fe57cef231fb93fd07e6)), ("dir/subdir/exe", Blob, Sha1(e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)), ("extra-file", Blob, Sha1(0000000000000000000000000000000000000000)), ("extra-exe", Blob, Sha1(0000000000000000000000000000000000000000)), ("extra-dir-empty", Tree, Sha1(0000000000000000000000000000000000000000)), ("extra-dir/symlink-to-extra", Link, Sha1(0000000000000000000000000000000000000000))]
And with (1) but before (3), the failure is:
--- STDERR: gix-archive::archive from_tree::basic_usage_tar ---
thread 'from_tree::basic_usage_tar' panicked at gix-archive\tests\archive.rs:116:13:
assertion `left == right` failed
left: [("prefix/.gitattributes", Regular, 56, 420), ("prefix/a", Regular, 3, 420), ("prefix/symlink-to-a", Symlink, 0, 420), ("prefix/dir/b", Regular, 3, 420), ("prefix/dir/subdir/exe", Regular, 0, 493), ("prefix/extra-file", Regular, 21, 420), ("prefix/extra-exe", Regular, 0, 420), ("prefix/extra-dir-empty", Directory, 0, 420), ("prefix/extra-dir/symlink-to-extra", Symlink, 0, 420)]
right: [("prefix/.gitattributes", Regular, 56, 420), ("prefix/a", Regular, 3, 420), ("prefix/symlink-to-a", Symlink, 0, 420), ("prefix/dir/b", Regular, 3, 420), ("prefix/dir/subdir/exe", Regular, 0, 420), ("prefix/extra-file", Regular, 21, 420), ("prefix/extra-exe", Regular, 0, 420), ("prefix/extra-dir-empty", Directory, 0, 420), ("prefix/extra-dir/symlink-to-extra", Symlink, 0, 420)]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
0 commit comments