t7502: test early quit from commit with bad ident

In commit f20f387, "git commit" notices and dies much earlier when we have a bogus commit identity. That commit did not add a test because we cannot do so reliably (namely, we can only trigger the behavior on a system where the automatically generated identity is bogus). However, now that we have a prerequisite check for this feature, we can add a test that will at least run on systems that produce such a bogus identity. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 26, 2012 at 16:32 UTC 8c8b3bc3f4e859be0af49f91e0d1831a9ae50324
1 file changed +17
t/t7502-commit.sh
+17
@@ -248,6 +248,8 @@ test_expect_success 'setup auto-ident prerequisite' '
248 sane_unset GIT_COMMITTER_NAME &&
249 git var GIT_COMMITTER_IDENT); then
250 test_set_prereq AUTOIDENT
251 + else
252 + test_set_prereq NOAUTOIDENT
253 fi
254 '
255
@@ -269,6 +271,21 @@ echo editor started > "$(pwd)/.git/result"
271 exit 0
272 EOF
273
274 +test_expect_success NOAUTOIDENT 'do not fire editor when committer is bogus' '
275 + >.git/result
276 + >expect &&
277 +
278 + echo >>negative &&
279 + (
280 + sane_unset GIT_COMMITTER_EMAIL &&
281 + sane_unset GIT_COMMITTER_NAME &&
282 + GIT_EDITOR="\"$(pwd)/.git/FAKE_EDITOR\"" &&
283 + export GIT_EDITOR &&
284 + test_must_fail git commit -e -m sample -a
285 + ) &&
286 + test_cmp expect .git/result
287 +'
288 +
289 test_expect_success 'do not fire editor in the presence of conflicts' '
290
291 git clean -f &&