From 0e21390d1c889d727f4809d7509b449ea27620f0 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Wed, 14 Mar 2018 07:23:55 +1100 Subject: [PATCH] check_commits: exit early if there are no commits --- check_commits | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/check_commits b/check_commits index 6fc5265..37457e7 100755 --- a/check_commits +++ b/check_commits @@ -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") -- 2.39.2