From: Stephen Rothwell Date: Tue, 13 Mar 2018 20:23:55 +0000 (+1100) Subject: check_commits: exit early if there are no commits X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=0e21390d1c889d727f4809d7509b449ea27620f0;p=next-scripts check_commits: exit early if there are no commits --- 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")