Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1bfd108

Browse files
authored
Properly detect if commit is a root commit
Fix bad check for ancestor root commits.
1 parent 51ac0e8 commit 1bfd108

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pre_commit/resources/pre-push-tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ do
88
if [ -n "$first_ancestor" ]; then
99
# Check that the ancestor has at least one parent
1010
git rev-list --max-parents=0 "$local_sha" | grep "$first_ancestor" > /dev/null
11-
if [ $? -ne 0 ]; then
11+
if [ $? -eq 0 ]; then
12+
# Pushing the whole tree, including the root commit, so run on all files
1213
args="--all-files"
1314
else
1415
source=$(git rev-parse "$first_ancestor"^)

0 commit comments

Comments
 (0)