From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"William Hubbs" <williamh@gentoo.org>,
chutzpah@gentoo.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v6 1/2] ident: test how GIT_* and user.{name,email} interact
Date: Tue, 5 Feb 2019 20:52:11 +0100 [thread overview]
Message-ID: <20190205195212.25550-2-avarab@gmail.com> (raw)
In-Reply-To: <20190204184850.10040-1-williamh@gentoo.org>
There were no explicit tests for the interaction between setting GIT_*
in the environment, and the user.{name,email} config variables. These
tests are basic, but we're about to learn
{author,committer}.{name,email} in addition to user.{name,email}, so
they'll soon become more useful.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
t/t7517-per-repo-email.sh | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/t/t7517-per-repo-email.sh b/t/t7517-per-repo-email.sh
index 231b8cc19d..84bd9e89e5 100755
--- a/t/t7517-per-repo-email.sh
+++ b/t/t7517-per-repo-email.sh
@@ -85,4 +85,38 @@ test_expect_success REBASE_P \
test_must_fail git rebase -p master
'
+test_expect_success 'fallbacks for GIT_* and user.{name,email}' '
+ # We must have committer in the object
+ test_must_fail test_env \
+ GIT_AUTHOR_NAME=author.name \
+ GIT_AUTHOR_EMAIL=author@email \
+ GIT_COMMITTER_NAME= \
+ GIT_COMMITTER_EMAIL= \
+ test_commit A 2>stderr &&
+ test_i18ngrep "empty ident name.*not allowed" stderr &&
+
+ # With no committer E-Mail we will have an empty field
+ test_env \
+ GIT_AUTHOR_NAME=author.name \
+ GIT_AUTHOR_EMAIL=author@email \
+ GIT_COMMITTER_NAME=committer.name \
+ GIT_COMMITTER_EMAIL= \
+ test_commit B 2>stderr &&
+ echo "author.name author@email committer.name " >expected &&
+ git log --format="%an %ae %cn %ce" -1 >actual &&
+ test_cmp expected actual &&
+
+ # Environment overrides config
+ test_config user.name author.config.name &&
+ test_env \
+ GIT_AUTHOR_NAME=author.name \
+ GIT_AUTHOR_EMAIL=author@email \
+ GIT_COMMITTER_NAME=committer.name \
+ GIT_COMMITTER_EMAIL= \
+ test_commit C 2>stderr &&
+ echo "author.name author@email committer.name " >expected &&
+ git log --format="%an %ae %cn %ce" -1 >actual &&
+ test_cmp expected actual
+'
+
test_done
--
2.20.1.611.gfbb209baf1
next prev parent reply other threads:[~2019-02-05 19:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-04 18:48 [PATCH v5 0/1] config: allow giving separate author and committer William Hubbs
2019-02-04 18:48 ` [PATCH v5 1/1] config: allow giving separate author and committer idents William Hubbs
2019-02-05 9:16 ` Johannes Schindelin
2019-02-05 18:02 ` Junio C Hamano
2019-02-05 19:52 ` [PATCH v6 0/2] New {author,committer}.{name,email} config Ævar Arnfjörð Bjarmason
2019-02-05 19:52 ` Ævar Arnfjörð Bjarmason [this message]
2019-02-05 19:52 ` [PATCH v6 2/2] config: allow giving separate author and committer idents Ævar Arnfjörð Bjarmason
2019-02-05 20:22 ` Junio C Hamano
2019-02-05 21:14 ` Ævar Arnfjörð Bjarmason
2019-02-06 0:04 ` William Hubbs
2019-02-06 0:15 ` William Hubbs
2019-02-06 1:05 ` William Hubbs
2019-02-06 5:03 ` Junio C Hamano
2019-02-13 16:43 ` William Hubbs
2019-02-13 22:37 ` Junio C Hamano
2019-02-14 18:17 ` William Hubbs
2019-02-06 8:58 ` Ævar Arnfjörð Bjarmason
2019-02-06 9:28 ` Ævar Arnfjörð Bjarmason
2019-02-06 18:26 ` Jeff King
2019-02-06 18:41 ` William Hubbs
2019-02-06 22:43 ` Junio C Hamano
2019-02-06 18:34 ` William Hubbs
2019-04-15 14:24 ` Derrick Stolee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190205195212.25550-2-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=chutzpah@gentoo.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=williamh@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).