fix: prevent pre-commit hook from staging unstaged changes #150
No reviewers
Labels
No labels
bug
ci
documentation
duplicate
enhancement
feature
good first issue
help wanted
invalid
performance
priority
P0
priority
P1
priority
P2
question
refactor
size
L
size
M
size
S
size
XL
size
XS
tests
trivial
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
noe.trevino/paso!150
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/precommit-hook-partial-staging"
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?
The gofmt pre-commit hook ran 'gofmt -w' on the working-tree copy and then 'git add ', which re-staged the entire file. Any unstaged hunks (e.g. from 'git add -p') were silently swept into the commit.
Rewrite the hook to format only the staged content:
Checklist
CONTRIBUTING.mdgo test ./... -race) locallygofmt -w .andgolangci-lint run ./...respectivelyREADME.mdif applicableSummary
closes #148