FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Better support for diff calculation for rebase workflow · Issue #2424 · pre-commit/pre-commit · GitHub

Repository navigation

Better support for diff calculation for rebase workflow #2424

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

Activity

  1. asottile commented on Jun 16, 2022

    Member

    dupe #860

  2. CharlesB2 commented on Apr 11, 2024

  3. locked as off topic and limited conversation to collaborators on Apr 11, 2024
  4. added a commit that references this issue on Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL