| test_description='rewrite diff' |
| test_expect_success setup ' |
| cat "$TEST_DIRECTORY"/../COPYING >test && |
| "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \ |
| "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \ |
| <"$TEST_DIRECTORY"/../COPYING >test && |
| echo "to be deleted" >test2 && |
| test_expect_success 'detect rewrite' ' |
| actual=$(git diff-files -B --summary test) && |
| expr "$actual" : " rewrite test ([0-9]*%)$" || { |
| diff --git a/test2 b/test2 |
| test_expect_success 'show deletion diff without -D' ' |
| git diff -- test2 >actual && |
| diff --git a/test2 b/test2 |
| test_expect_success 'suppress deletion diff with -D' ' |
| git diff -D -- test2 >actual && |
| test_expect_success 'show deletion diff with -B' ' |
| git diff -B -- test >actual && |
| grep "Linus Torvalds" actual |
| test_expect_success 'suppress deletion diff with -B -D' ' |
| git diff -B -D -- test >actual && |
| grep -v "Linus Torvalds" actual |