Skip to content

Commit e961c13

Browse files
committed
Avoid rm -v in fixtures for portability
This removes `-v` from an `rm -R` command in `make_basic_repo.sh`, which can cause tests that needed to run that fixture to fail on systems where `rm` does not support `-v`. The script generates a fixtured used in numerous tests, and it is always run even if `GIX_TEST_IGNORE_ARCHIVES` is not set, since its output is `.gitignore`d. Because the script is so heavily used, this change allows many more tests to pass on systems where `rm` does not recognize `-v` than before. `rm -v` is actually POSIX, but it was standardized very recently, in 1003.1-2024; it was not even required in 1003.1-2017. Some Unix systems' `rm` commands do not recognize `-v`. This includes most (or all?) illumos and Solaris systems (except when `/usr/gnu/bin` is present and placed early in the `$PATH`). It seems likely that there are a number of other such systems. Regarding the history of `rm -v` in POSIX, see: - https://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html - https://pubs.opengroup.org/onlinepubs/9799919799/utilities/rm.html - https://www.austingroupbugs.net/view.php?id=1154 - https://www.austingroupbugs.net/view.php?id=1365 - https://www.austingroupbugs.net/view.php?id=1487 Based on a `git grep -En 'rm( -[^v ;&|]*)+v'` search, this occurrence in `make_basic_repo.sh` appears to be the only place where `-v` is passed to `rm` in any gitoxide fixture script. Two nearby similar, conceptually related commands omit `-v`, and when this command (rather, the command that turned into it) was introduced in the first version of the script in a4cec4a (#399), another such command without `-v` was also present. This suggests that `-v` may have been used for exploratory purposes during development, such that the approach here of omitting `-v` it without replacing it with anything might be sufficient. However, it is possible for information shown when the fixture script runs and fails to be less informative as a result of this omission. An alternative approach to the one taken here could be to have the script carry out a tiny experiment to check if `-v` is supported, then use it only if it was found to be accepted. (Another option could be to use `find` with both `-print` and `-delete`, though that might be stronger than desired given that the affected `rm` command does not pass `-f`.)
1 parent 22209fd commit e961c13

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gix-discover/tests/fixtures/make_basic_repo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ rm -R worktrees/c-worktree-deleted
3535
(cd bare.git
3636
git worktree add ../worktrees/from-bare/c
3737
git worktree add ../worktrees/from-bare/d-private-dir-deleted
38-
rm -R -v ./worktrees/d-private-dir-deleted
38+
rm -R ./worktrees/d-private-dir-deleted
3939
)
4040

4141
git clone --bare --shared . bare-no-config.git

0 commit comments

Comments
 (0)