Re: [PATCH v2 1/2] [Outreachy] t3903-stash: test without configured user.name and user.email

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux