]> git.ozlabs.org Git - next-scripts/blobdiff - check_commits
check_commits: exit early if there are no commits
[next-scripts] / 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")