diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-10-11 14:52:23 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-11 14:52:23 +0900 |
commit | 6defdc9fe863bd637102f8b5420501654d4a9346 (patch) | |
tree | c889514e52b2b845e9e3a624015ff2ddc4b39227 /fsck.c | |
parent | Merge branch 'jk/sha1-loose-object-info-fix' (diff) | |
parent | fsck: handle NULL return of lookup_blob() and lookup_tree() (diff) | |
download | tgif-6defdc9fe863bd637102f8b5420501654d4a9346.tar.xz |
Merge branch 'rs/fsck-null-return-from-lookup'
Improve behaviour of "git fsck" upon finding a missing object.
* rs/fsck-null-return-from-lookup:
fsck: handle NULL return of lookup_blob() and lookup_tree()
Diffstat (limited to 'fsck.c')
-rw-r--r-- | fsck.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -358,15 +358,15 @@ static int fsck_walk_tree(struct tree *tree, void *data, struct fsck_options *op continue; if (S_ISDIR(entry.mode)) { - obj = &lookup_tree(entry.oid)->object; - if (name) + obj = (struct object *)lookup_tree(entry.oid); + if (name && obj) put_object_name(options, obj, "%s%s/", name, entry.path); result = options->walk(obj, OBJ_TREE, data, options); } else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode)) { - obj = &lookup_blob(entry.oid)->object; - if (name) + obj = (struct object *)lookup_blob(entry.oid); + if (name && obj) put_object_name(options, obj, "%s%s", name, entry.path); result = options->walk(obj, OBJ_BLOB, data, options); |