Thread (1 message) 1 message, 1 author, 2018-11-16

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

From: Junio C Hamano <hidden>
Date: 2018-11-16 06:26:09

Junio C Hamano [off-list ref] 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.
quoted
+	(
+		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.
quoted
+		git stash
+	)
+'
+
 test_done
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help