From 07fa5378b6d80c5c0dd212910ad8e81aa8067b6f Mon Sep 17 00:00:00 2001 From: Filippos Giannakos Date: Mon, 6 Mar 2017 15:50:36 +0200 Subject: [PATCH] Properly detect if commit is a root commit Fix a bug in the pre-push template, where the commit was wrongly identified as a root commit with no parents. --- pre_commit/resources/pre-push-tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_commit/resources/pre-push-tmpl b/pre_commit/resources/pre-push-tmpl index 81d0dcbe..dc952475 100644 --- a/pre_commit/resources/pre-push-tmpl +++ b/pre_commit/resources/pre-push-tmpl @@ -8,7 +8,7 @@ do if [ -n "$first_ancestor" ]; then # Check that the ancestor has at least one parent git rev-list --max-parents=0 "$local_sha" | grep "$first_ancestor" > /dev/null - if [ $? -ne 0 ]; then + if [ $? -eq 0 ]; then args="run --all-files" else source=$(git rev-parse "$first_ancestor"^)