Urgent.News

What's breaking now, across thousands of outlets.

AI

My Hook's Path Fix Passed Its Own Test. It Broke My README's Other Install Method.

Four days ago I fixed a bug in a git hook I wrote: hooks/prepare-commit-msg , which shells out to a small script ( git_commit.py ) that asks Claude to pre-fill a Conventional Commit message. The hook had never once actually worked, because it computed its own script path one directory too shallow. I fixed it, verified it against a real install, wrote it up, moved on. This morning I went looking…

Four days ago, a bug was fixed in a git hook named hooks/prepare-commit-msg. This hook utilized a small script (git_commit.py) that asked Claude to pre-fill a Conventional Commit message. However, the hook had never worked correctly because it computed its own script path one directory too shallow. The bug was fixed, verified against a real install, and the fix was documented.

The following day, while looking for something else to check in the repository, the author noticed that their own README.md contained two ways to install the hook. The fix only worked for one of the installation methods. The author analyzed the relevant line of code in the hook, which was designed to compute the script path correctly.

The author then tested both installation methods using a real clone of the repository and verified that the hook was invoked correctly in both cases. The author concluded that the path-arithmetic fix, which was initially tuned for one installation method, did not work for the other installation method. A third installation method, such as a symlink or a monorepo nesting, would require a different depth.

The author realized that the original fix only worked for one specific installation method and did not address the issue for the other method. They proposed a solution to stop relying on $0 to determine the script path and instead use git's rev-parse --show-toplevel command to find the repository's root directory. By implementing this change, both installation methods would work correctly, regardless of the path to the hook file.

The author emphasized that their original fix had successfully passed its own verification, but the change in the README's installation instructions created a dependency issue that needed to be addressed.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

I built a tool that roasts your code with regex — no AI involved

The problem In 2026, devs spend 11.4 hours a week reviewing AI-generated code — more time than they spend writing it. We're burning cycles fixing bugs our own AI tools wrote.

  • Roast My Code assesses code maintainability debt via regex patterns
  • Tool provides AI Debt Score 0-100 with three critique suggestions
  • Client-side regex analysis ensures code confidentiality and instant feedback

Architecture Decisions Before Writing a Single Line

The most valuable thing Claude has done for my work is help me make better architectural decisions before I start building.

  • Claude provided architectural guidance for hotel reservation system
  • Multi-currency pricing and timezone conversion separated into services
  • 20-minute discussion improved critical thinking and system design

More from Tuesday 4 August →