Skip to content

Commit 58ec9cb

Browse files
larsxschneidergitster
authored andcommitted
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>
1 parent 0339965 commit 58ec9cb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

t/t0021-conversion.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ test_cmp_count () {
4242
for FILE in "$expect" "$actual"
4343
do
4444
sort "$FILE" | uniq -c |
45-
sed -e "s/^ *[0-9][0-9]*[ ]*IN: /x IN: /" >"$FILE.tmp" &&
46-
mv "$FILE.tmp" "$FILE" || return
45+
sed -e "s/^ *[0-9][0-9]*[ ]*IN: /x IN: /" >"$FILE.tmp"
4746
done &&
48-
test_cmp "$expect" "$actual"
47+
test_cmp "$expect.tmp" "$actual.tmp" &&
48+
rm "$expect.tmp" "$actual.tmp"
4949
}
5050

5151
# Compare two files but exclude all `clean` invocations because Git can
@@ -56,10 +56,10 @@ test_cmp_exclude_clean () {
5656
actual=$2
5757
for FILE in "$expect" "$actual"
5858
do
59-
grep -v "IN: clean" "$FILE" >"$FILE.tmp" &&
60-
mv "$FILE.tmp" "$FILE"
59+
grep -v "IN: clean" "$FILE" >"$FILE.tmp"
6160
done &&
62-
test_cmp "$expect" "$actual"
61+
test_cmp "$expect.tmp" "$actual.tmp" &&
62+
rm "$expect.tmp" "$actual.tmp"
6363
}
6464

6565
# Check that the contents of two files are equal and that their rot13 version

0 commit comments

Comments
 (0)