~ubuntu-branches/ubuntu/intrepid/git-core/intrepid-security

« back to all changes in this revision

Viewing changes to t/t4008-diff-break-rewrite.sh

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-10-04 08:27:01 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20071004082701-rsd058ontoqz4i30
Tags: 1:1.5.3.4-1
new upstream point release (closes: #445188).

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    setup \
29
29
    'cat ../../README >file0 &&
30
30
     cat ../../COPYING >file1 &&
31
 
    git-update-index --add file0 file1 &&
32
 
    tree=$(git-write-tree) &&
 
31
    git update-index --add file0 file1 &&
 
32
    tree=$(git write-tree) &&
33
33
    echo "$tree"'
34
34
 
35
35
test_expect_success \
36
36
    'change file1 with copy-edit of file0 and remove file0' \
37
37
    'sed -e "s/git/GIT/" file0 >file1 &&
38
38
     rm -f file0 &&
39
 
    git-update-index --remove file0 file1'
 
39
    git update-index --remove file0 file1'
40
40
 
41
41
test_expect_success \
42
42
    'run diff with -B' \
43
 
    'git-diff-index -B --cached "$tree" >current'
 
43
    'git diff-index -B --cached "$tree" >current'
44
44
 
45
45
cat >expected <<\EOF
46
46
:100644 000000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 0000000000000000000000000000000000000000 D      file0
53
53
 
54
54
test_expect_success \
55
55
    'run diff with -B and -M' \
56
 
    'git-diff-index -B -M "$tree" >current'
 
56
    'git diff-index -B -M "$tree" >current'
57
57
 
58
58
cat >expected <<\EOF
59
59
:100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 08bb2fb671deff4c03a4d4a0a1315dff98d5732c R100   file0   file1
66
66
test_expect_success \
67
67
    'swap file0 and file1' \
68
68
    'rm -f file0 file1 &&
69
 
     git-read-tree -m $tree &&
70
 
     git-checkout-index -f -u -a &&
 
69
     git read-tree -m $tree &&
 
70
     git checkout-index -f -u -a &&
71
71
     mv file0 tmp &&
72
72
     mv file1 file0 &&
73
73
     mv tmp file1 &&
74
 
     git-update-index file0 file1'
 
74
     git update-index file0 file1'
75
75
 
76
76
test_expect_success \
77
77
    'run diff with -B' \
78
 
    'git-diff-index -B "$tree" >current'
 
78
    'git diff-index -B "$tree" >current'
79
79
 
80
80
cat >expected <<\EOF
81
81
:100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 6ff87c4664981e4397625791c8ea3bbb5f2279a3 M100   file0
88
88
 
89
89
test_expect_success \
90
90
    'run diff with -B and -M' \
91
 
    'git-diff-index -B -M "$tree" >current'
 
91
    'git diff-index -B -M "$tree" >current'
92
92
 
93
93
cat >expected <<\EOF
94
94
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100   file1   file0
103
103
    'make file0 into something completely different' \
104
104
    'rm -f file0 &&
105
105
     ln -s frotz file0 &&
106
 
     git-update-index file0 file1'
 
106
     git update-index file0 file1'
107
107
 
108
108
test_expect_success \
109
109
    'run diff with -B' \
110
 
    'git-diff-index -B "$tree" >current'
 
110
    'git diff-index -B "$tree" >current'
111
111
 
112
112
cat >expected <<\EOF
113
113
:100644 120000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 67be421f88824578857624f7b3dc75e99a8a1481 T      file0
120
120
 
121
121
test_expect_success \
122
122
    'run diff with -B' \
123
 
    'git-diff-index -B -M "$tree" >current'
 
123
    'git diff-index -B -M "$tree" >current'
124
124
 
125
125
# This should not mistake file0 as the copy source of new file1
126
126
# due to type differences.
135
135
 
136
136
test_expect_success \
137
137
    'run diff with -M' \
138
 
    'git-diff-index -M "$tree" >current'
 
138
    'git diff-index -M "$tree" >current'
139
139
 
140
140
# This should not mistake file0 as the copy source of new file1
141
141
# due to type differences.
151
151
test_expect_success \
152
152
    'file1 edited to look like file0 and file0 rename-edited to file2' \
153
153
    'rm -f file0 file1 &&
154
 
     git-read-tree -m $tree &&
155
 
     git-checkout-index -f -u -a &&
 
154
     git read-tree -m $tree &&
 
155
     git checkout-index -f -u -a &&
156
156
     sed -e "s/git/GIT/" file0 >file1 &&
157
157
     sed -e "s/git/GET/" file0 >file2 &&
158
158
     rm -f file0
159
 
     git-update-index --add --remove file0 file1 file2'
 
159
     git update-index --add --remove file0 file1 file2'
160
160
 
161
161
test_expect_success \
162
162
    'run diff with -B' \
163
 
    'git-diff-index -B "$tree" >current'
 
163
    'git diff-index -B "$tree" >current'
164
164
 
165
165
cat >expected <<\EOF
166
166
:100644 000000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 0000000000000000000000000000000000000000 D      file0
174
174
 
175
175
test_expect_success \
176
176
    'run diff with -B -M' \
177
 
    'git-diff-index -B -M "$tree" >current'
 
177
    'git diff-index -B -M "$tree" >current'
178
178
 
179
179
cat >expected <<\EOF
180
180
:100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 08bb2fb671deff4c03a4d4a0a1315dff98d5732c C095   file0   file1