-
-
Notifications
You must be signed in to change notification settings - Fork 910
Closed
Description
search tried in the issue tracker
pre-push
describe your issue
In a monorepo workflow where user workflow includes rebase on top of default branch to get latest changes, diff calculation for pre-push hooks can often result in files that was updated in default branch instead of user feature branch. This led to a lot of linters being triggered on files irrelevant to users.
Sample workflow:
git checkout master
git fetch origin
git reset --hard origin/master
git checkout -b user1/feature-a
<coding>
git add a
git commit -a -m "add ft a"
git push
<more coding>
git add a
git commit -a -m "adjust ft a"
git fetch origin
git rebase origin/master
git push --force
On the second git-push, we expect that only pre-push hooks which are relevant to file a, which the user is responsible for, are executed. However, the effective diff range was origin/master@{1}..origin/master + origin/master..HEAD which can include thousands of files in a fast moving monorepo.
There should be a config that let user ignore the changes in default branch entirely.
pre-commit --version
2.17.0
.pre-commit-config.yaml
N/A~/.cache/pre-commit/pre-commit.log (if present)
N/A
CharlesB2
Metadata
Metadata
Assignees
Labels
No labels