]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t9001: use a more distinct fake BugID
authorJeff King <peff@peff.net>
Sun, 15 Sep 2024 11:31:15 +0000 (07:31 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Sep 2024 16:27:52 +0000 (09:27 -0700)
In the test "cc list is sanitized", we feed a commit with a variety of
trailers to send-email, and then check its output to see how it handled
them. For most of them, we are grepping for a specific mention of the
header, but there's a "BugID" header which we expect to be ignored. We
confirm this by grepping for "12345", the fake BugID, and making sure it
is not present.

But we can be fooled by false positives! I just tracked down a flaky
test failure here that was caused by matching this unrelated line in the
output:

  <20240914090449.612345-1-author@example.com>

which will change from run to run based on the time, pid, etc.

Ideally we'd tighten the regex to make this more specifically, but since
the point is that it _shouldn't_ be mentioned, it's hard to say what the
right match would be (e.g., would there be a leading space?).

Instead, let's just choose a match that is much less likely to appear.
The actual content of the header isn't important, since it's supposed to
be ignored.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t9001-send-email.sh

index 64a4ab3736ef86ae6cd92d6f0370c76565d124a0..b1e31e73847a0127c2c5c38b8fa4dfb63c6d494c 100755 (executable)
@@ -1324,7 +1324,7 @@ test_expect_success $PREREQ 'cc list is sanitized' '
        Reviewed-by: Füñný Nâmé <odd_?=mail@example.com>
        Reported-by: bugger on Jira
        Reported-by: Douglas Reporter <doug@example.com> [from Jira profile]
-       BugID: 12345
+       BugID: 12345should-not-appear
        Co-developed-by: "C. O. Developer" <codev@example.com>
        Signed-off-by: A. U. Thor <thor.au@example.com>
        EOF
@@ -1337,7 +1337,7 @@ test_expect_success $PREREQ 'cc list is sanitized' '
 " <odd_?=mail@example.com>" actual-show-all-headers &&
        test_grep "^(body) Ignoring Reported-by .* bugger on Jira" actual-show-all-headers &&
        test_grep "^(body) Adding cc: Douglas Reporter <doug@example.com>" actual-show-all-headers &&
-       test_grep ! "12345" actual-show-all-headers &&
+       test_grep ! "12345should-not-appear" actual-show-all-headers &&
        test_grep "^(body) Adding cc: \"C. O. Developer\" <codev@example.com>" actual-show-all-headers &&
        test_grep "^(body) Adding cc: \"A. U. Thor\" <thor.au@example.com>" actual-show-all-headers
 '