diff options
author | Lars Schneider <larsxschneider@gmail.com> | 2017-06-01 08:21:59 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-26 17:34:42 (GMT) |
commit | 58ec9cb35baaad29f11e16faa2e032650c17d77d (patch) | |
tree | c95792fd47a8a9054a67657d8a60401901d72c24 /t/t0021-conversion.sh | |
parent | 0339965c70d68fd3831c9a5306443c869de3f6a8 (diff) | |
download | git-58ec9cb35baaad29f11e16faa2e032650c17d77d.zip git-58ec9cb35baaad29f11e16faa2e032650c17d77d.tar.gz git-58ec9cb35baaad29f11e16faa2e032650c17d77d.tar.bz2 |
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/t0021-conversion.sh')
-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 161f560..ff24242 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 |