From 3ebbd64a3c311925b5a0c9ebc94488560613d30b Mon Sep 17 00:00:00 2001 From: Miroslav Franc Date: May 15 2023 09:30:08 +0000 Subject: bugzilla-create: take bugzilla email from BUGZILLA_ACCOUNT_EMAIL env var Some people have emails in bugzilla that are completely different than emails they use in git and providing one with -e option is tedious. Make bugzilla-create more flexible by providing the third options that sits between command line option and git-config automation. Signed-off-by: Miroslav Franc --- diff --git a/scripts/bugzilla-create b/scripts/bugzilla-create index 4c6f8e3..50719db 100755 --- a/scripts/bugzilla-create +++ b/scripts/bugzilla-create @@ -86,8 +86,9 @@ Options: * Print this message Notes: - * If no email address specified, the username component of git-config - user.email will be used with @suse.com appended. + * If no email address is specified with -e option or BUGZILLA_ACCOUNT_EMAIL + environment variable, the username component of git-config user.email + will be used with @suse.com appended. * If no product is specified, the \$BUGZILLA_PRODUCT variable in rpm/config.sh will be used, if present. * If the patch already contains references, they will be preserved with @@ -102,8 +103,13 @@ END } # Defaults -EMAIL="$(git config user.email)" -EMAIL="${EMAIL%%@*}@suse.com" +if [ -n "${BUGZILLA_ACCOUNT_EMAIL}" ] +then + EMAIL="${BUGZILLA_ACCOUNT_EMAIL}" +else + EMAIL="$(git config user.email)" + EMAIL="${EMAIL%%@*}@suse.com" +fi . $(dirname $0)/../rpm/config.sh PRODUCT="${BUGZILLA_PRODUCT}"