[Bug] hook status reports a non-executable post-commit hook as installed
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 74/100
Research direction
Start in packages/cli/src/repowise/cli/hooks.py, especially install and status around the cited lines, then trace the doctor check in commands/doctor_cmd/repo_checks.py:227. Confirm Git's executable-hook behavior on POSIX and the Windows distinction, then add coverage for marker-present hooks without execute permission. Done means install, status, and doctor distinguish a non-executable hook while remaining quiet on Windows.
Written by the indexing model from the issue text.
Description
Summary
hooks.status decides the post-commit hook is installed from the presence of the marker comment. It does not check the executable bit, and install sets that bit inside a suppressed exception.
packages/cli/src/repowise/cli/hooks.py:405-411:
content = hook_path.read_text(encoding="utf-8")
if _HOOK_MARKER in content:
pending = husky_pending_reason(hook_path.parent)
return f"installed ({pending})" if pending else "installed"
return "not installed"
packages/cli/src/repowise/cli/hooks.py:350-352:
# Make executable (no-op on Windows but harmless)
with contextlib.suppress(OSError):
hook_path.chmod(hook_path.stat().st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
If that chmod raises, install still returns "installed" and status still reports installed, over a file git will not run.
Consequence
On POSIX, git skips a post-commit hook that is not executable. The user then has a repository where repowise hook status says installed, repowise doctor says the same through commands/doctor_cmd/repo_checks.py:227, and the wiki silently never updates after a commit. The symptom is "state never moves", which is the exact symptom the hook's own comment block says the .update.log capture was added to make diagnosable (hooks.py:49-55).
The realistic ways to reach it are narrow: a .git/hooks directory mounted read-only, a filesystem with no execute bit, or a restrictive umask combined with the append branch writing into a file someone else created. It is not a common case, and this is filed as a small correctness gap rather than a frequent failure.
The suppression itself is reasonable. chmod is a genuine no-op on Windows and failing an install over it would be worse. The gap is that nothing downstream ever checks whether it took.
Done looks like
status distinguishes "the block is there and git will run it" from "the block is there". Something like a third return for the marker-present but not-executable case, so hook status and doctor can say which one it is.
install reporting it is the other half and probably the more useful one, since that is the moment the user is standing there. It already has the return value to carry it, alongside the existing "installed" and "already installed".
Both need to stay quiet on Windows, where the bit is meaningless. os.access(path, os.X_OK) reports true for most files on Windows, so a stat.S_IXUSR check gated on os.name != "nt" is likely the cleaner test.
Scope note
Verified by reading install and status in full. I did not construct a repository where the chmod fails, so the failure is reasoned from the code rather than reproduced. Anyone picking this up should confirm the git behaviour they are protecting against on their own platform before choosing the test.
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 711
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 439
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from repowise-dev/repowise
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
repowise-dev/repowise#2471 · 1 comment ·
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
repowise-dev/repowise#2469 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
repowise-dev/repowise#2379 ·
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
repowise-dev/repowise#2354 · 1 comment ·
-
documentation good first issue
Difficulty 1/5 Under an hour Newbie friendliness 92/100
repowise-dev/repowise#2353 ·
All issues in repowise-dev/repowise
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100