diff options
author | Samuel Bronson <naesten@gmail.com> | 2013-12-18 19:08:10 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-12-18 16:26:12 -0800 |
commit | b527773092c1455e964d756777d4092c09c9222d (patch) | |
tree | 979466f1bdd30d961009ee13fc8041020ddf661e /t | |
parent | d7aced95cd681b761468635f8d2a8b82d7ed26fd (diff) | |
download | git-b527773092c1455e964d756777d4092c09c9222d.tar.gz git-b527773092c1455e964d756777d4092c09c9222d.tar.xz |
t4056: add new tests for "git diff -O"
Adapted from $gmane/236427 by Anders Waldenborg, "diff: Add
diff.orderfile configuration variable".
Signed-off-by: Anders Waldenborg <anders@0x63.nu>
Signed-off-by: Samuel Bronson <naesten@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t4056-diff-order.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/t/t4056-diff-order.sh b/t/t4056-diff-order.sh new file mode 100755 index 000000000..c39ec4121 --- /dev/null +++ b/t/t4056-diff-order.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +test_description='diff order' + +. ./test-lib.sh + +create_files () { + echo "$1" >a.h && + echo "$1" >b.c && + echo "$1" >c/Makefile && + echo "$1" >d.txt && + git add a.h b.c c/Makefile d.txt && + git commit -m"$1" +} + +test_expect_success 'setup' ' + mkdir c && + create_files 1 && + create_files 2 && + + cat >order_file_1 <<-\EOF && + *Makefile + *.txt + *.h + EOF + + cat >order_file_2 <<-\EOF && + *Makefile + *.h + *.c + EOF + + cat >expect_none <<-\EOF && + a.h + b.c + c/Makefile + d.txt + EOF + + cat >expect_1 <<-\EOF && + c/Makefile + d.txt + a.h + b.c + EOF + + cat >expect_2 <<-\EOF + c/Makefile + a.h + b.c + d.txt + EOF +' + +test_expect_success "no order (=tree object order)" ' + git diff --name-only HEAD^..HEAD >actual && + test_cmp expect_none actual +' + +for i in 1 2 +do + test_expect_success "orderfile using option ($i)" ' + git diff -Oorder_file_$i --name-only HEAD^..HEAD >actual && + test_cmp expect_$i actual + ' +done + +test_done |