From 3484df9ca4c3a297cbe6b4581189aad45a4f6709 Mon Sep 17 00:00:00 2001 From: jacobherrington Date: Fri, 23 Aug 2019 20:30:18 -0500 Subject: [PATCH] Ensure arguments exist --- bin/git-coauthor | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/git-coauthor b/bin/git-coauthor index 2d69a37..a13f456 100755 --- a/bin/git-coauthor +++ b/bin/git-coauthor @@ -1,4 +1,10 @@ #!/usr/bin/env bash +coauthor=$1 +email=$2 + +test -z $coauthor && echo "co-author required." 1>&2 && exit 1 +test -z $email && echo "co-author email required." 1>&2 && exit 1 + old_message="$(git log --format=%B -n1)" -git commit --amend -m "$old_message" -m "Co-authored-by: $1 <$2>" +git commit --amend -m "$old_message" -m "Co-authored-by: $coauthor <$email>"