treat any file with NUL as binary
[git/git-p4.git] / t / t4018-diff-funcname.sh
blobf9db81d3abae824f1f34faeeec537c5607e8ebad
1 #!/bin/sh
3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description='Test custom diff function name patterns'
8 . ./test-lib.sh
10 LF='
13 cat > Beer.java << EOF
14 public class Beer
16 int special;
17 public static void main(String args[])
19 String s=" ";
20 for(int x = 99; x > 0; x--)
22 System.out.print(x + " bottles of beer on the wall "
23 + x + " bottles of beer\n"
24 + "Take one down, pass it around, " + (x - 1)
25 + " bottles of beer on the wall.\n");
27 System.out.print("Go to the store, buy some more,\n"
28 + "99 bottles of beer on the wall.\n");
31 EOF
33 sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
35 test_expect_success 'default behaviour' '
36 git diff Beer.java Beer-correct.java |
37 grep "^@@.*@@ public class Beer"
40 test_expect_success 'preset java pattern' '
41 echo "*.java diff=java" >.gitattributes &&
42 git diff Beer.java Beer-correct.java |
43 grep "^@@.*@@ public static void main("
46 git config diff.java.funcname '!static
47 !String
48 [^ ].*s.*'
50 test_expect_success 'custom pattern' '
51 git diff Beer.java Beer-correct.java |
52 grep "^@@.*@@ int special;$"
55 test_expect_success 'last regexp must not be negated' '
56 git config diff.java.funcname "!static" &&
57 ! git diff Beer.java Beer-correct.java
60 test_done