[PATCH] t4038: add tests for "diff --cc --raw <trees>"
- From
John Keeping <john@keeping.me.uk>
- Date
- Feb 5, 2013, 20:25 UTC
- Message-ID
- <20130205202558.GX1342@serenity.lan>
- In-Reply-To
- <7vip696i3v.fsf@alter.siamese.dyndns.org>
Signed-off-by: John Keeping <john@keeping.me.uk> --- On Sun, Feb 03, 2013 at 04:24:52PM -0800, Junio C Hamano wrote:
Show 5 quoted lines
> Ideally it should also have test cases > to show "git diff --cc --raw blob1 blob2...blob$n" for n=4 and n=40 > (or any two values clearly below and above the old hardcoded limit) > behave sensibly, exposing the old breakage, which I'll leave as a > LHF (low-hanging-fruit). Hint, hint...
Hint taken ;-)
git-diff uses a different code path for blobs, so I've had to use trees to trigger this. The last test fails without jc/combine-diff-many-parents and passes with it.
t/t4038-diff-combined.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh index 40277c7..a0701bc 100755 --- a/t/t4038-diff-combined.sh +++ b/t/t4038-diff-combined.sh @@ -89,4 +89,33 @@ test_expect_success 'diagnose truncated file' ' grep "diff --cc file" out ' +test_expect_success 'setup for --cc --raw' ' + blob=$(echo file |git hash-object --stdin -w) && + base_tree=$(echo "100644 blob $blob file" | git mktree) && + trees= && + for i in `test_seq 1 40` + do + blob=$(echo file$i |git hash-object --stdin -w) && + trees="$trees $(echo "100644 blob $blob file" |git mktree)" + done +' + +test_expect_success 'check --cc --raw with four trees' ' + four_trees=$(echo "$trees" |awk -e "{ + print \$1 + print \$2 + print \$3 + print \$4 + }") && + git diff --cc --raw $four_trees $base_tree >out && + # Check for four leading colons in the output: + grep "^::::[^:]" out +' + +test_expect_success 'check --cc --raw with forty trees' ' + git diff --cc --raw $trees $base_tree >out && + # Check for forty leading colons in the output: + grep "^::::::::::::::::::::::::::::::::::::::::[^:]" out +' + test_done
-- 1.8.1.2