xtask: install-hooks checks the hook it says it installed #635
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!635
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:hooks-executable"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
The problem on main:
cargo xtask install-hooksrunsgit config core.hooksPath .githooks, checks only the exit status, and then printshooks installed: commits now run \cargo xtask policy --staged`(xtask/src/main.rs:37-45). But the hook it points at is tracked as mode **100644** (git ls-files -s .githooks/pre-commit→100644 …), and git looks a hook up withaccess(X_OK)`: on a POSIX clone git prints "The '.githooks/pre-commit' hook was ignored because it's not set as executable" and runs nothing, so the only automated enforcement of the repository's first rule — nothing from the game is ever committed — is absent while the command reports it in place. Git for Windows runs hooks without the execute bit, which is why this looked correct from here.This change fixes both halves of that one defect:
.githooks/pre-commitis recorded with the executable bit (git update-index --chmod=+x), so the commit carriesmode change 100644 => 100755and a clone checks it out executable;installed(mode: Option<u32>) -> Result<String>bails, naming the remedy, when there is a mode with no execute bit; returns the existing success line when there is one; and on Windows (no execute bit to read) prints the success line plus "its mode was not checked — a POSIX clone ignores.githooks/pre-commitunless it is executable".How it was tested
71e9390(one commit onc8258f9).cargo test --locked -p xtask— 11 passed, 0 failed (the new tests forinstalledare among them).cargo clippy --locked -p xtask --all-targets -- -D warningspasses.git show --summary HEADshowsmode change 100644 => 100755 .githooks/pre-commitand no content change to the hook.installed(None)no longer carries the warning;installed(Some(0o644))returnsOkinstead of the error naming the remedy), which is exactly the state that made the command lie.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.cargo test --locked -p xtaskis green (11 passed). The whole-workspace run is not green on this machine for the pre-existingdarner-gpureasons (#224, #150), which this does not touch.cargo xtask policy: passes.access(X_OK)behaviour of a POSIX clone is reasoned from git's documented behaviour, not observed here. The hook's content is unchanged.Checklist
main.docs/asset-policy.md(cargo xtask policy: passes).Checked for overlap
xtask/src/main.rsor.githooks/pre-commit(checked against the file list of all 189 open pull requests), and no open or closed issue mentionsinstall-hooksor a hook that is not executable.[pr-fix] xtask: install-hooks checks the hook it says it installedto xtask: install-hooks checks the hook it says it installedView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.