summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-05-11 18:00:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-13 02:08:56 (GMT)
commita5411df0d9fb659321c6ce001c1f8d6e08426b8b (patch)
treea1f18aaf75c781a4901f4d3877f0d051b760d13b /revision.c
parent468165c1d8a442994a825f3684528361727cd8c0 (diff)
downloadgit-a5411df0d9fb659321c6ce001c1f8d6e08426b8b.zip
git-a5411df0d9fb659321c6ce001c1f8d6e08426b8b.tar.gz
git-a5411df0d9fb659321c6ce001c1f8d6e08426b8b.tar.bz2
mark_tree_contents_uninteresting(): drop missing object check
It's generally acceptable for UNINTERESTING objects in a traversal to be unavailable (e.g., see aeeae1b771). When marking trees UNINTERESTING, we access the object database twice: once to check if the object is missing (and return quietly if it is), and then again to actually parse it. We can instead just try to parse; if that fails, we can then return quietly. That halves the effort we spend on locating the object. Note that this isn't _exactly_ the same as the original behavior, as the parse failure could be due to other problems than a missing object: it could be corrupted, in which case the original code would have died. But the new behavior is arguably better, as it covers the object being unavailable for any reason. We'll also still issue a warning to stderr in such a case. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/revision.c b/revision.c
index b42c836..9de92bb 100644
--- a/revision.c
+++ b/revision.c
@@ -51,12 +51,9 @@ static void mark_tree_contents_uninteresting(struct tree *tree)
{
struct tree_desc desc;
struct name_entry entry;
- struct object *obj = &tree->object;
- if (!has_object_file(&obj->oid))
+ if (parse_tree_gently(tree, 1) < 0)
return;
- if (parse_tree(tree) < 0)
- die("bad tree %s", oid_to_hex(&obj->oid));
init_tree_desc(&desc, tree->buffer, tree->size);
while (tree_entry(&desc, &entry)) {