diff options
author | Lars Schneider <larsxschneider@gmail.com> | 2017-06-01 10:21:59 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-26 10:34:42 -0700 |
commit | 58ec9cb35baaad29f11e16faa2e032650c17d77d (patch) | |
tree | c95792fd47a8a9054a67657d8a60401901d72c24 /t | |
parent | Fourth batch for 2.14 (diff) | |
download | tgif-58ec9cb35baaad29f11e16faa2e032650c17d77d.tar.xz |
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>
Diffstat (limited to 't')
-rwxr-xr-x | t/t0021-conversion.sh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index 161f560446..ff2424225b 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -42,10 +42,10 @@ test_cmp_count () { for FILE in "$expect" "$actual" do sort "$FILE" | uniq -c | - sed -e "s/^ *[0-9][0-9]*[ ]*IN: /x IN: /" >"$FILE.tmp" && - mv "$FILE.tmp" "$FILE" || return + sed -e "s/^ *[0-9][0-9]*[ ]*IN: /x IN: /" >"$FILE.tmp" 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 @@ -56,10 +56,10 @@ test_cmp_exclude_clean () { actual=$2 for FILE in "$expect" "$actual" do - grep -v "IN: clean" "$FILE" >"$FILE.tmp" && - mv "$FILE.tmp" "$FILE" + grep -v "IN: clean" "$FILE" >"$FILE.tmp" 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 |