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

« back to all changes in this revision

Viewing changes to t/t5300-pack-object.sh

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-04-22 13:31:05 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20070422133105-tkmhz328g2p0epz1
Tags: 1:1.5.1.2-1
* new upstream point release.
* debian/changelog.upstream: upstream changes taken from mailing list
  announcement.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    'unpack without delta' \
45
45
    "GIT_OBJECT_DIRECTORY=.git2/objects &&
46
46
     export GIT_OBJECT_DIRECTORY &&
47
 
     git-init-db &&
 
47
     git-init &&
48
48
     git-unpack-objects -n <test-1-${packname_1}.pack &&
49
49
     git-unpack-objects <test-1-${packname_1}.pack"
50
50
 
64
64
cd "$TRASH"
65
65
 
66
66
test_expect_success \
67
 
    'pack with delta' \
 
67
    'pack with REF_DELTA' \
68
68
    'pwd &&
69
69
     packname_2=$(git-pack-objects test-2 <obj-list)'
70
70
 
72
72
mkdir .git2
73
73
 
74
74
test_expect_success \
75
 
    'unpack with delta' \
 
75
    'unpack with REF_DELTA' \
76
76
    'GIT_OBJECT_DIRECTORY=.git2/objects &&
77
77
     export GIT_OBJECT_DIRECTORY &&
78
 
     git-init-db &&
 
78
     git-init &&
79
79
     git-unpack-objects -n <test-2-${packname_2}.pack &&
80
80
     git-unpack-objects <test-2-${packname_2}.pack'
81
81
 
82
82
unset GIT_OBJECT_DIRECTORY
83
83
cd "$TRASH/.git2"
84
84
test_expect_success \
85
 
    'check unpack with delta' \
86
 
    '(cd ../.git && find objects -type f -print) |
87
 
     while read path
88
 
     do
89
 
         cmp $path ../.git/$path || {
90
 
             echo $path differs.
91
 
             return 1
92
 
         }
93
 
     done'
94
 
cd "$TRASH"
 
85
    'check unpack with REF_DELTA' \
 
86
    '(cd ../.git && find objects -type f -print) |
 
87
     while read path
 
88
     do
 
89
         cmp $path ../.git/$path || {
 
90
             echo $path differs.
 
91
             return 1
 
92
         }
 
93
     done'
 
94
cd "$TRASH"
 
95
 
 
96
test_expect_success \
 
97
    'pack with OFS_DELTA' \
 
98
    'pwd &&
 
99
     packname_3=$(git-pack-objects --delta-base-offset test-3 <obj-list)'
 
100
 
 
101
rm -fr .git2
 
102
mkdir .git2
 
103
 
 
104
test_expect_success \
 
105
    'unpack with OFS_DELTA' \
 
106
    'GIT_OBJECT_DIRECTORY=.git2/objects &&
 
107
     export GIT_OBJECT_DIRECTORY &&
 
108
     git-init &&
 
109
     git-unpack-objects -n <test-3-${packname_3}.pack &&
 
110
     git-unpack-objects <test-3-${packname_3}.pack'
 
111
 
 
112
unset GIT_OBJECT_DIRECTORY
 
113
cd "$TRASH/.git2"
 
114
test_expect_success \
 
115
    'check unpack with OFS_DELTA' \
 
116
    '(cd ../.git && find objects -type f -print) |
 
117
     while read path
 
118
     do
 
119
         cmp $path ../.git/$path || {
 
120
             echo $path differs.
 
121
             return 1
 
122
         }
 
123
     done'
 
124
cd "$TRASH"
 
125
 
 
126
test_expect_success 'compare delta flavors' '
 
127
        perl -e '\''
 
128
                defined($_ = -s $_) or die for @ARGV;
 
129
                exit 1 if $ARGV[0] <= $ARGV[1];
 
130
        '\'' test-2-$packname_2.pack test-3-$packname_3.pack
 
131
'
95
132
 
96
133
rm -fr .git2
97
134
mkdir .git2
100
137
    'use packed objects' \
101
138
    'GIT_OBJECT_DIRECTORY=.git2/objects &&
102
139
     export GIT_OBJECT_DIRECTORY &&
103
 
     git-init-db &&
 
140
     git-init &&
104
141
     cp test-1-${packname_1}.pack test-1-${packname_1}.idx .git2/objects/pack && {
105
142
         git-diff-tree --root -p $commit &&
106
143
         while read object
111
148
    } >current &&
112
149
    diff expect current'
113
150
 
114
 
 
115
151
test_expect_success \
116
 
    'use packed deltified objects' \
 
152
    'use packed deltified (REF_DELTA) objects' \
117
153
    'GIT_OBJECT_DIRECTORY=.git2/objects &&
118
154
     export GIT_OBJECT_DIRECTORY &&
119
 
     rm -f .git2/objects/pack/test-?.idx &&
 
155
     rm .git2/objects/pack/test-* &&
120
156
     cp test-2-${packname_2}.pack test-2-${packname_2}.idx .git2/objects/pack && {
121
157
         git-diff-tree --root -p $commit &&
122
158
         while read object
127
163
    } >current &&
128
164
    diff expect current'
129
165
 
 
166
test_expect_success \
 
167
    'use packed deltified (OFS_DELTA) objects' \
 
168
    'GIT_OBJECT_DIRECTORY=.git2/objects &&
 
169
     export GIT_OBJECT_DIRECTORY &&
 
170
     rm .git2/objects/pack/test-* &&
 
171
     cp test-3-${packname_3}.pack test-3-${packname_3}.idx .git2/objects/pack && {
 
172
         git-diff-tree --root -p $commit &&
 
173
         while read object
 
174
         do
 
175
            t=`git-cat-file -t $object` &&
 
176
            git-cat-file $t $object || return 1
 
177
         done <obj-list
 
178
    } >current &&
 
179
    diff expect current'
 
180
 
130
181
unset GIT_OBJECT_DIRECTORY
131
182
 
132
183
test_expect_success \
133
184
    'verify pack' \
134
 
    'git-verify-pack test-1-${packname_1}.idx test-2-${packname_2}.idx'
 
185
    'git-verify-pack    test-1-${packname_1}.idx \
 
186
                        test-2-${packname_2}.idx \
 
187
                        test-3-${packname_3}.idx'
135
188
 
136
189
test_expect_success \
137
190
    'corrupt a pack and see if verify catches' \
194
247
     git-index-pack test-3.pack &&
195
248
     cmp test-3.idx test-2-${packname_2}.idx &&
196
249
 
 
250
     cp test-3-${packname_3}.pack test-3.pack &&
 
251
     git-index-pack -o tmp.idx test-3-${packname_3}.pack &&
 
252
     cmp tmp.idx test-3-${packname_3}.idx &&
 
253
 
 
254
     git-index-pack test-3.pack &&
 
255
     cmp test-3.idx test-3-${packname_3}.idx &&
 
256
 
197
257
     :'
198
258
 
 
259
test_expect_success \
 
260
    'fake a SHA1 hash collision' \
 
261
    'test -f    .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67 &&
 
262
     cp -f      .git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \
 
263
                .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67'
 
264
 
 
265
test_expect_failure \
 
266
    'make sure index-pack detects the SHA1 collision' \
 
267
    'git-index-pack -o bad.idx test-3.pack'
 
268
 
199
269
test_done