Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False Positive On Second Commit in Repo #90

Open
Kurt-von-Laven opened this issue Sep 16, 2021 · 0 comments
Open

False Positive On Second Commit in Repo #90

Kurt-von-Laven opened this issue Sep 16, 2021 · 0 comments

Comments

@Kurt-von-Laven
Copy link

Kurt-von-Laven commented Sep 16, 2021

protect-first-parent reports an error when attempting to commit the second commit in a repository.

Protect first parent..........................................................Failed
- hook id: protect-first-parent
- exit code: 1

[ERROR] Foxtrot merge

Maybe you deleted a commit that was already pushed.
Maybe you ran "git pull" without the --rebase flag.

A possible fix is to run these commands client-side before pushing:

    git fetch --all
    git rebase main

Check the result with "git log --graph" before pushing again.

[FAIL] See errors above for /home/kurt/.cache/pre-commit/repoyqzer_ly/pre_commit_hooks/protect-first-parent

While testing this again on a fresh repository, I also see the following:

fatal: ambiguous argument 'main^..': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

It doesn't make any difference whether the second commit is to the default branch or a feature branch. The second case seems obviously caused by the attempt to get the commit before the HEAD of main, and presumably this also causes a crash for the initial commit to a repository. Since the HEAD of main is the initial commit, this fails. I don't understand what causes the first case yet though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant