]> git.ozlabs.org Git - next-scripts/commitdiff
check_commits: exit early if there are no commits
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 13 Mar 2018 20:23:55 +0000 (07:23 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 13 Mar 2018 20:23:55 +0000 (07:23 +1100)
check_commits

index 6fc5265420a69a390006122728a1dc8b46950de0..37457e777343deb730620abda3bcf1d56171fac3 100755 (executable)
@@ -5,7 +5,13 @@ if [ "$#" -lt 1 ]; then
        exit 1
 fi
 
-for c in $(git rev-list --no-merges "$@"); do
+commits=$(git rev-list --no-merges "$@")
+if [ -z "$commits" ]; then
+       printf "No commits\n"
+       exit 0
+fi
+
+for c in $commits; do
        ae=$(git log -1 --format='%ae' "$c")
        aE=$(git log -1 --format='%aE' "$c")
        an=$(git log -1 --format='%an' "$c")