From: Jonathan Nieder Date: Fri, 24 Sep 2010 07:09:50 GMT Subject: [PATCH 03/24] t9300 (fast-import): guard "export large marks" test setup Message-ID: <20100924070950.GD4666@burratino> In-Reply-To: <20100924065900.GA4666@burratino> Since the setup for the large marks test involves more complex code than just a "cat", "echo", or assignment, make it part of the test_expect_success assertion. This way, the test script will report a failure if the setup breaks from a coding mistake, unusual shell, or other unforseen circumstance. While at it, make some other small simplifications (grouping commands that write to the same file with { }; using ">file" instead of ": >file" to empty a file). Cc: Shawn O. Pearce Signed-off-by: Jonathan Nieder --- t/t9300-fast-import.sh | 106 +++++++++++++++++++++++++----------------------- 1 files changed, 55 insertions(+), 51 deletions(-) diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index ed37a4e..735ac83 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -184,58 +184,62 @@ test_expect_success \ test `git rev-parse --verify master:file2` \ = `git rev-parse --verify verify--import-marks:copy-of-file2`' -test_tick -mt=$(git hash-object --stdin < /dev/null) -: >input.blob -: >marks.exp -: >tree.exp - -cat >input.commit < $GIT_COMMITTER_DATE -data <>input.blob <>input.commit - echo "M 100644 :$m m$i" >>input.commit - echo "M 100644 :$n n$i" >>input.commit - - echo ":$l $mt" >>marks.exp - echo ":$m $mt" >>marks.exp - echo ":$n $mt" >>marks.exp - - printf "100644 blob $mt\tl$i\n" >>tree.exp - printf "100644 blob $mt\tm$i\n" >>tree.exp - printf "100644 blob $mt\tn$i\n" >>tree.exp - - l=$(($l + $l)) - m=$(($m + $m)) - n=$(($l + $n)) - - i=$((1 + $i)) -done - -sort tree.exp > tree.exp_s - test_expect_success 'A: export marks with large values' ' + test_tick && + mt=$(git hash-object --stdin input.blob && + >marks.exp && + >tree.exp && + + cat >input.commit <<-EOF && + commit refs/heads/verify--dump-marks + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <>input.blob <<-EOF && + blob + mark :$l + data 0 + blob + mark :$m + data 0 + blob + mark :$n + data 0 + EOF + { + echo "M 100644 :$l l$i" && + echo "M 100644 :$m m$i" && + echo "M 100644 :$n n$i" + } >>input.commit && + { + echo ":$l $mt" && + echo ":$m $mt" && + echo ":$n $mt" + } >>marks.exp && + { + printf "100644 blob $mt\tl$i\n" && + printf "100644 blob $mt\tm$i\n" && + printf "100644 blob $mt\tn$i\n" + } >>tree.exp && + l=$(($l + $l)) && + m=$(($m + $m)) && + n=$(($l + $n)) && + i=$((1 + $i)) || + exit + done + ) && + sort tree.exp >tree.exp_s && cat input.blob input.commit | git fast-import --export-marks=marks.large && git ls-tree refs/heads/verify--dump-marks >tree.out && test_cmp tree.exp_s tree.out && -- 1.7.2.3