git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t4014: remove Message-Id/timestamp before comparing patches

From
Thomas Rast <trast@student.ethz.ch>
Date
Sep 19, 2011, 06:45 UTC
Message-ID
<6b2cb6ebec907342a02d56a36ddc58715efabc00.1316414731.git.trast@student.ethz.ch>

The test introduced in 787570c (format-patch: ignore ui.color, 2011-09-13) has a race condition: if the two format-patch invocations do not ask for the current time in the same second, their Message-Id headers will disagree.

Normally this would be a pretty unlikely occurrence. However, under valgrind format-patch runs so slowly that the race triggers every time, with a time difference of 2-3s on my hardware.

To avoid this problem, replace the contents of the Message-Id header with a dummy before comparing.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/t4014-format-patch.sh |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 7e405d7..8700089 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -886,11 +886,18 @@ test_expect_success 'empty subject prefix does not have extra space' '
 	test_cmp expect actual
 '
 
+strip_msgid () {
+	sed 's#\(Message-Id: *\)<[^>]*>#\1<MESSAGE@ID>#' "$1" >"$1+" &&
+	mv "$1+" "$1"
+}
+
 test_expect_success 'format patch ignores color.ui' '
 	test_unconfig color.ui &&
 	git format-patch --stdout -1 >expect &&
+	strip_msgid expect &&
 	test_config color.ui always &&
 	git format-patch --stdout -1 >actual &&
+	strip_msgid actual &&
 	test_cmp expect actual
 '
 
-- 
1.7.7.rc1.366.ge210a6
Next: Junio C Hamano
Message 1 of 5 in “t4014: remove Message-Id/timestamp before comparing patches”
  1. t4014: remove Message-Id/timestamp before comparing patchesThomas Rast, Sep 19, 2011
  2. Junio C HamanoSep 19, 2011
  3. Jeff KingSep 19, 2011
  4. Junio C HamanoSep 19, 2011
  5. Thomas RastSep 20, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.