Skip to content

Commit

Permalink
t4038: add tests for "diff --cc --raw <trees>"
Browse files Browse the repository at this point in the history
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
John Keeping authored and Junio C Hamano committed Feb 5, 2013
1 parent 7766705 commit edbc00e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions t/t4038-diff-combined.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,28 @@ 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)$LF"
done
'

test_expect_success 'check --cc --raw with four trees' '
four_trees=$(echo "$trees" | sed -e 4q) &&
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

0 comments on commit edbc00e

Please sign in to comment.