builtin-blame.c: remove unneeded memclr()
[git/gitweb.git] / t / t4024-diff-optimize-common.sh
blob20fe87b7dd4456895879ce3a7197864599666267
1 #!/bin/sh
3 test_description='common tail optimization'
5 . ./test-lib.sh
7 z=zzzzzzzz ;# 8
8 z="$z$z$z$z$z$z$z$z" ;# 64
9 z="$z$z$z$z$z$z$z$z" ;# 512
10 z="$z$z$z$z" ;# 2048
11 z2047=$(expr "$z" : '.\(.*\)') ; #2047
13 test_expect_success setup '
15 echo "a$z2047" >file-a &&
16 echo "b" >file-b &&
17 echo "$z2047" >>file-b &&
18 echo "c$z2047" | tr -d "\012" >file-c &&
19 echo "d" >file-d &&
20 echo "$z2047" | tr -d "\012" >>file-d &&
22 git add file-a file-b file-c file-d &&
24 echo "A$z2047" >file-a &&
25 echo "B" >file-b &&
26 echo "$z2047" >>file-b &&
27 echo "C$z2047" | tr -d "\012" >file-c &&
28 echo "D" >file-d &&
29 echo "$z2047" | tr -d "\012" >>file-d
33 cat >expect <<\EOF
34 diff --git a/file-a b/file-a
35 --- a/file-a
36 +++ b/file-a
37 @@ -1 +1 @@
38 -aZ
39 +AZ
40 diff --git a/file-b b/file-b
41 --- a/file-b
42 +++ b/file-b
43 @@ -1 +1 @@
46 diff --git a/file-c b/file-c
47 --- a/file-c
48 +++ b/file-c
49 @@ -1 +1 @@
50 -cZ
51 \ No newline at end of file
52 +CZ
53 \ No newline at end of file
54 diff --git a/file-d b/file-d
55 --- a/file-d
56 +++ b/file-d
57 @@ -1 +1 @@
60 EOF
62 test_expect_success 'diff -U0' '
64 git diff -U0 | sed -e "/^index/d" -e "s/$z2047/Z/g" >actual &&
65 diff -u expect actual
69 test_done