[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