mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Properly detect if commit is a root commit
Fix bad check for ancestor root commits.
This commit is contained in:
parent
51ac0e8bc0
commit
1bfd108593
1 changed files with 2 additions and 1 deletions
|
|
@ -8,7 +8,8 @@ do
|
||||||
if [ -n "$first_ancestor" ]; then
|
if [ -n "$first_ancestor" ]; then
|
||||||
# Check that the ancestor has at least one parent
|
# Check that the ancestor has at least one parent
|
||||||
git rev-list --max-parents=0 "$local_sha" | grep "$first_ancestor" > /dev/null
|
git rev-list --max-parents=0 "$local_sha" | grep "$first_ancestor" > /dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
# Pushing the whole tree, including the root commit, so run on all files
|
||||||
args="--all-files"
|
args="--all-files"
|
||||||
else
|
else
|
||||||
source=$(git rev-parse "$first_ancestor"^)
|
source=$(git rev-parse "$first_ancestor"^)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue