t0021: keep filter log files on comparison
The filter log files are modified on comparison. That might be unexpected by the caller. It would be even undesirable if the caller wants to reuse the original log files. Address these issues by using temp files for modifications. This is useful for the subsequent patch 'convert: add "status=delayed" to filter process protocol'. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0339965c70
commit
58ec9cb35b
@ -42,10 +42,10 @@ test_cmp_count () {
|
|||||||
for FILE in "$expect" "$actual"
|
for FILE in "$expect" "$actual"
|
||||||
do
|
do
|
||||||
sort "$FILE" | uniq -c |
|
sort "$FILE" | uniq -c |
|
||||||
sed -e "s/^ *[0-9][0-9]*[ ]*IN: /x IN: /" >"$FILE.tmp" &&
|
sed -e "s/^ *[0-9][0-9]*[ ]*IN: /x IN: /" >"$FILE.tmp"
|
||||||
mv "$FILE.tmp" "$FILE" || return
|
|
||||||
done &&
|
done &&
|
||||||
test_cmp "$expect" "$actual"
|
test_cmp "$expect.tmp" "$actual.tmp" &&
|
||||||
|
rm "$expect.tmp" "$actual.tmp"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Compare two files but exclude all `clean` invocations because Git can
|
# Compare two files but exclude all `clean` invocations because Git can
|
||||||
@ -56,10 +56,10 @@ test_cmp_exclude_clean () {
|
|||||||
actual=$2
|
actual=$2
|
||||||
for FILE in "$expect" "$actual"
|
for FILE in "$expect" "$actual"
|
||||||
do
|
do
|
||||||
grep -v "IN: clean" "$FILE" >"$FILE.tmp" &&
|
grep -v "IN: clean" "$FILE" >"$FILE.tmp"
|
||||||
mv "$FILE.tmp" "$FILE"
|
|
||||||
done &&
|
done &&
|
||||||
test_cmp "$expect" "$actual"
|
test_cmp "$expect.tmp" "$actual.tmp" &&
|
||||||
|
rm "$expect.tmp" "$actual.tmp"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that the contents of two files are equal and that their rot13 version
|
# Check that the contents of two files are equal and that their rot13 version
|
||||||
|
Loading…
Reference in New Issue
Block a user