3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description
='Test custom diff function name patterns'
13 cat > Beer.java
<< EOF
17 public static void main(String args[])
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");
33 sed 's/beer\\/beer,\\/' < Beer.java
> Beer-correct.java
35 test_expect_success
'default behaviour' '
36 git diff --no-index 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 --no-index Beer.java Beer-correct.java |
43 grep "^@@.*@@ public static void main("
46 git config
diff.java.funcname
'!static
50 test_expect_success
'custom pattern' '
51 git diff --no-index 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 --no-index Beer.java Beer-correct.java