File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,10 +180,10 @@ static void show_object(struct object *obj,
180180 const struct name_path * path , const char * component ,
181181 void * cb_data )
182182{
183- struct rev_info * info = cb_data ;
183+ struct rev_list_info * info = cb_data ;
184184
185185 finish_object (obj , path , component , cb_data );
186- if (info -> verify_objects && !obj -> parsed && obj -> type != OBJ_COMMIT )
186+ if (info -> revs -> verify_objects && !obj -> parsed && obj -> type != OBJ_COMMIT )
187187 parse_object (obj -> sha1 );
188188 show_object_with_name (stdout , obj , path , component );
189189}
Original file line number Diff line number Diff line change @@ -191,4 +191,30 @@ test_expect_success 'cleaned up' '
191191 test_cmp empty actual
192192'
193193
194+ test_expect_success ' rev-list --verify-objects' '
195+ git rev-list --verify-objects --all >/dev/null 2>out &&
196+ test_cmp empty out
197+ '
198+
199+ test_expect_success ' rev-list --verify-objects with bad sha1' '
200+ sha=$(echo blob | git hash-object -w --stdin) &&
201+ old=$(echo $sha | sed "s+^..+&/+") &&
202+ new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff &&
203+ sha="$(dirname $new)$(basename $new)" &&
204+ mv .git/objects/$old .git/objects/$new &&
205+ test_when_finished "remove_object $sha" &&
206+ git update-index --add --cacheinfo 100644 $sha foo &&
207+ test_when_finished "git read-tree -u --reset HEAD" &&
208+ tree=$(git write-tree) &&
209+ test_when_finished "remove_object $tree" &&
210+ cmt=$(echo bogus | git commit-tree $tree) &&
211+ test_when_finished "remove_object $cmt" &&
212+ git update-ref refs/heads/bogus $cmt &&
213+ test_when_finished "git update-ref -d refs/heads/bogus" &&
214+
215+ test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out &&
216+ cat out &&
217+ grep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out
218+ '
219+
194220test_done
You can’t perform that action at this time.
0 commit comments