From 971a126276f6de1d4ef7ec2fb71a7f5ccecb9ec8 Mon Sep 17 00:00:00 2001 From: kale Date: Tue, 26 Dec 2023 18:09:11 +0100 Subject: [PATCH] identity: allowed displaying an identity with an empty first field --- scripts/identity.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/identity.sh b/scripts/identity.sh index 323322b..652f651 100755 --- a/scripts/identity.sh +++ b/scripts/identity.sh @@ -34,8 +34,11 @@ function display_parts() { local email="$3"; local sigkey="$4"; - printf "[$identity] $name <$email>"; - if [ ! -z $sigkey ]; then + if [ ! -z "$identity" ]; then + printf "[$identity] "; + fi + printf "$name <$email>"; + if [ ! -z "$sigkey" ]; then printf " (signing key: $sigkey)"; fi printf "\n"; @@ -190,7 +193,7 @@ case $1 in ;; show) if [ -z "$2" ]; then - display_parts "current" "$(git config user.name)" "$(git config user.email)" "$(git config user.signingKey)"; + display_parts "" "$(git config user.name)" "$(git config user.email)" "$(git config user.signingKey)"; else get_identity "$2"; display_identity "$identity";