Commit 16b88c5
Fix release script pre-commit hook race condition (#2012)
## Summary
- Fixes the `rake release` task failing with "Unable to create
index.lock" error
- Root cause: Multiple pre-commit hooks running in parallel tried to
`git add` files simultaneously, causing a race condition for the git
index lock
- Solution: Use lefthook's built-in `stage_fixed: true` option instead
of manual `git add` commands
## Changes
- Updated `.lefthook.yml` to add `stage_fixed: true` to autofix, eslint,
and prettier hooks
- Removed manual `git add` calls from `bin/lefthook/prettier-format`
- Removed manual `git add` calls from `bin/lefthook/ruby-autofix`
- Added glob patterns to hook definitions for better performance
## Test Plan
- [x] Tested commit with multiple file changes (prettier formatted
`.lefthook.yml`)
- [x] Verified no `index.lock` errors occur
- [x] Confirmed files are properly re-staged after formatting
- [x] RuboCop passes with no violations
## Impact
This fix ensures that the release script can successfully commit version
bumps without encountering race conditions when multiple formatters try
to re-stage files.
<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/2012)
<!-- Reviewable:end -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Added file-type globs to pre-commit hook configurations for autofix,
RuboCop, ESLint, and Prettier.
* Removed automatic re-staging of files after formatting and autofixing;
commands now leave staging unchanged.
* Adjusted autofix completion message for clarity.
* No functional change to trailing-newlines or pre-push checks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude <[email protected]>1 parent c1ae439 commit 16b88c5
File tree
5 files changed
+12
-37
lines changed- bin/lefthook
5 files changed
+12
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
| 14 | + | |
12 | 15 | | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
| 19 | + | |
15 | 20 | | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
| 24 | + | |
18 | 25 | | |
| 26 | + | |
19 | 27 | | |
20 | 28 | | |
21 | 29 | | |
| 30 | + | |
22 | 31 | | |
23 | 32 | | |
24 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | | - | |
| 22 | + | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 28 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 37 | | |
43 | 38 | | |
44 | 39 | | |
| |||
56 | 51 | | |
57 | 52 | | |
58 | 53 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | 54 | | |
65 | 55 | | |
66 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | 27 | | |
33 | 28 | | |
34 | 29 | | |
| |||
44 | 39 | | |
45 | 40 | | |
46 | 41 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 42 | | |
53 | 43 | | |
54 | 44 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 22 | + | |
0 commit comments