Junio C Hamano <[email protected]> writes:
> 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.
>> + git stash
>> + )
>> +'
>> +
>> test_done