diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-04-29 01:11:47 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-04-29 01:11:47 +0400 |
commit | 50d3062ab2cea4e999b8f3bafd211ff348bca600 (patch) | |
tree | 26cfdd46c59963b0301bd57d492a73f0abadbb5f /t | |
parent | 76a89d6d828486f96f42c69ef0cf87bb6b72fef5 (diff) | |
parent | 467ddc14fe37ea6a3d77058fb24c4240e82e6344 (diff) |
Merge branch 'jc/diff-irreversible-delete'
* jc/diff-irreversible-delete:
git diff -D: omit the preimage of deletes
Diffstat (limited to 't')
-rwxr-xr-x | t/t4022-diff-rewrite.sh | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh index 2a537a21e8..c00a94b9ba 100755 --- a/t/t4022-diff-rewrite.sh +++ b/t/t4022-diff-rewrite.sh @@ -11,7 +11,9 @@ test_expect_success setup ' tr \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \ - <"$TEST_DIRECTORY"/../COPYING >test + <"$TEST_DIRECTORY"/../COPYING >test && + echo "to be deleted" >test2 && + git add test2 ' @@ -25,5 +27,44 @@ test_expect_success 'detect rewrite' ' ' +cat >expect <<EOF +diff --git a/test2 b/test2 +deleted file mode 100644 +index 4202011..0000000 +--- a/test2 ++++ /dev/null +@@ -1 +0,0 @@ +-to be deleted +EOF +test_expect_success 'show deletion diff without -D' ' + + rm test2 && + git diff -- test2 >actual && + test_cmp expect actual +' + +cat >expect <<EOF +diff --git a/test2 b/test2 +deleted file mode 100644 +index 4202011..0000000 +EOF +test_expect_success 'suppress deletion diff with -D' ' + + git diff -D -- test2 >actual && + test_cmp expect 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 +' + test_done |