Re: [PATCH v2 1/2] [Outreachy] t3903-stash: test without configured user.name and user.email
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 16, 2018, 06:26 UTC
- Message-ID
- <xmqqa7m9k07b.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <xmqqsh01k1mr.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
> Now we start using use-config-only, so unsetting environment > variables will cause trouble when Git insists on having an > explicitly configured identities. Makes sense. > >> + ( >> + sane_unset GIT_AUTHOR_NAME && >> + sane_unset GIT_AUTHOR_EMAIL && >> + sane_unset GIT_COMMITTER_NAME && >> + sane_unset GIT_COMMITTER_EMAIL && >> + test_unconfig user.email && >> + test_unconfig user.name && > > And then we try the same test, but without environment or config.
I suspect that it makes sense to replace the "git stash" we see below with something like this:
test_must_fail git commit -m should fail && echo "git stash <git@stash>" >expect && echo >2 && git stash && git show -s --format="%(authorname) <%(authoremail)>" refs/stash >actual && test_cmp expect actual
That is
- we make sure "commit" would not go through, to make sure our preparation to unset environment variables was sufficient;
- we make sure "stash" does succeed (which is the primary thing you are interested in);
- we make sure the resulting "stash" is not created under our default identity but under our fallback one.
Show 5 quoted lines
>> + git stash >> + ) >> +' >> + >> test_done