-
-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update an archive and add some missing executable bits #1589
Conversation
In b12c7c9 (GitoxideLabs#1587), the `make_dangling_symlink_to_windows_reserved` script was changed to fix typos. Though this did not alter its effect, its hash changed, so the committed archive generated from it could no longer be used. This commits a regenerated archive.
Some of the more recently introduced fixture scripts were not marked executable, even though the others are. Because `gix-testtools` has a fallback that runs scripts with `bash` explictly when executing them directly fails, this did not break any scripts, but the executable bit is also useful to document which files are meant to be runnable scripts. This marks them executable. Now all the shell scripts that begin with a `#!` have the executable bit set. (The handful of `.sh` files that are not meant to be run as scripts, but instead are sourced by other scripts, do not start with `#!` and continue not to have `+x` applied to them.)
Thanks a lot, much appreciated. I wondered if there should be a CI job that tests invariants, maybe based on |
I don't know a good near-instantaneous way to test whether archives need to be regenerated without having just run the tests. This is one of the reasons I implemented #1590 the way I did. For scripts, though, we can certainly check all non-ignored files to make sure that files that seem to be scripts (or, I think better, that seem to be plain text) start with
|
I like the idea of implementing such functionality in Rust instead. However, I'd hope to bring more of such 'internal' functionality into the Maybe another argument could be made to say that Despite all of this, my disposition is to turn |
Checking that fixtures have correct executable bits seems like something relevant to most users of |
That's fair - let's put it into |
As alluded to in #1692 (comment), I no longer favor putting this in the The reason is that it will either be portable to Windows or not:
|
In theory, it should be OK for If a tool were to use Git to learn about executable bits, I'd think it could even use |
If that is acceptable, then another option could be for this to be a shell script. An approach I do not favor, kept in for completeness (click to expand)
Or, if the script does not modify anything but just reports files that start with I favor this approach, because while there is much less risk of data loss here than in
I view the main benefits of doing this in Rust to be that it would demonstrate how to use gitoxide to check the repository and staged files (for both metadata and blob content), and that I might find it enjoyable to practice doing so. If external I'll look into this further and, unless I find reasons to prefer otherwise (or you point out any), I'll do this as a shell script that reports incongruities in the index of |
Even though doing it as shell-script will be fine, if you'd prefer to write it in Rust then I think there should be no issue adding it to |
It is rare that text files should be stored in a repository with a leading `#!` (shebang, a.k.a. hashbang) but `-x` permissions, or with no leading `#!` but `+x` permissions. But it is easy for this to happen by accident. This introduces a script to check for that situation -- currently only in files whose names end in `.sh`, which are the files in which this minor problem has tended to arise in this repository. This adds a `justfile` recipe for it, as well as a CI job that runs the script. (The CI job does not run it via `just`, since not doing so allows it to save time by not installing anything.) Currently, this: - Looks only at what is committed and staged, ignoring unstaged files and unstaged mode changes. (This is intended to allow it to be cross platform, because on Windows, Git repositories support the same modes as anywhere else, but the filesystem doesn't support Unix-style executable permissions.) - Is implemented as a shell script. Unlike `copy-packetline.sh`, there would be no major disadvantage to having this be Rust code instead, since it is never used to correct a problem that keeps Rust code from building. - Is called from a separate CI job than any others. But it could probably be called from one of the existing jobs instead. There are some files already in the repository that fail the new check, which should be given `+x` permissions. In this commit, they are kept as-is, and new files that should be detected as *wrongly* having `+x` permissions are added. This is to verify that the script is fully working as expected, including when run on CI. Once that is confirmed, the new test files can be removed, the scripts missing `+x` fixed, and the CI job made to run only on Ubuntu. (See the commented discussion in GitoxideLabs#1589 for further information.)
Thanks! I've opened #1708 for this. I had already written it as a shell script, so for now I've kept that way (this is discussed a bit in the PR description). |
One of the fixture scripts was modified in b12c7c9 (#1587) to fix typos, which changed its hash, but a regenerated archive was not committed at that time.
Other fixture scripts were recently introduced, and they have current archives committed, but they were not given executable bits, even though they are executable scripts that start with
#!
and the other fixture scripts have+x
.This small "maintenance" PR addresses those two things (one per commit).
I have verified that tests pass locally on Ubuntu 24.04 LTS, macOS 14.6, and Windows 10, both before and after this change, and that the
make_dangling_symlink_to_windows_reserved
archive, which previously had an uncommitted change on Ubuntu and macOS after running the tests, is no longer changed when the test suite is run. (It did not show as dirty on Windows becausegix-testtools
suppresses archive generation on Windows, but committing the regenerated script should help Windows tests to run slightly faster, too.)