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
Fails when force pushing unrelated histories #2002
Comments
I can't reproduce, please provide an example as force pushing is working fine for me |
The forced push is on unrelated heads and so git cannot get the difference. Below is my output... git.exe push -v --progress --force "github" master:main
Pushing to https://github.com/bogusfocused/ha_lan_smartthings.git
An unexpected error has occurred: CalledProcessError: command: ('C:\\Program Files\\Git\\mingw64\\libexec\\git-core
\\git.EXE', 'diff', '--name-only', '--no-ext-diff', '-z',
'8e9e6537d911cbfa8a88aa608c3afa893a340f8c...ced7786cd5098f321b48e9a1027cce4e8938cbbf')
return code: 128
expected return code: 0
stdout: (none)
stderr:
fatal: 8e9e6537d911cbfa8a88aa608c3afa893a340f8c...ced7786cd5098f321b48e9a1027cce4e8938cbbf: no merge base
Check the log at C:\Users\Rohit\.cache\pre-commit\pre-commit.log
error: failed to push some refs to 'https://github.com/bogusfocused/ha_lan_smartthings.git'
git did not exit cleanly (exit code 1) (1672 ms @ 8/9/2021 12:48:56 PM) |
ah yeah if you're force pushing unrelated histories then that'll happen -- I'm not sure there's much that could be done in that case since it's really "push everything" |
hmmm actually I still can't reproduce -- what version of |
Thanks. The fix works for me. |
pre-commit looks to find difference between remote and local branches as pre-commit wants to know the files changed. But in case of force, git correctly fails to generate diff.
Expected: pre-commit can run all the hooks that has pass-filename=false as they do not require diffs.
Thanks for the awesome stuff!
The text was updated successfully, but these errors were encountered: