]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t7518: fix flaky grep invocation
authorElijah Newren <newren@gmail.com>
Fri, 16 Oct 2020 23:39:54 +0000 (23:39 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 18 Oct 2020 20:17:53 +0000 (13:17 -0700)
t7518.1 added in commit 862e80a413 ("ident: handle NULL email when
complaining of empty name", 2017-02-23), was trying to make sure that
the test with an empty ident did not segfault and did not result in
glibc quiety translating a NULL pointer into a name of "(null)".  It did
the latter by ensuring that a grep for "null" didn't appear in the
output, but on one automatic CI run I observed the following output:

fatal: empty ident name (for <runner@fv-az128-670.gcliasfzo2nullsdbrimjtbyhg.cx.internal.cloudapp.net>) not allowed

Note that 'null' appears as a substring of the domain name, found
within 'gcliasfzo2nullsdbrimjtbyhg'.  Tighten the test by searching for
"(null)" rather than "null".

Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7518-ident-corner-cases.sh

index b22f631261f0a666ff5c4dc226be4f758f002709..91b9348946055934014a3611c176e3dc297f1cb4 100755 (executable)
@@ -13,7 +13,7 @@ test_expect_success 'empty name and missing email' '
                sane_unset GIT_AUTHOR_EMAIL &&
                GIT_AUTHOR_NAME= &&
                test_must_fail git commit --allow-empty -m foo 2>err &&
-               test_i18ngrep ! null err
+               test_i18ngrep ! "(null)" err
        )
 '