cat-file: use oidset check-and-insert

We don't need to check if the oidset has our object before we insert it; that's done as part of the insertion. We can just rely on the return value from oidset_insert(), which saves one hash lookup per object. This measurable speedup is tiny and within the run-to-run noise, but the result is simpler to read, too. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 14, 2018 at 14:14 UTC ced9fff75dad2578d7583ba3085970b03c66c57b
1 file changed +1 -2
builtin/cat-file.c
+1 -2
@@ -443,9 +443,8 @@ static int batch_unordered_object(const struct object_id *oid, void *vdata)
443 {
444 struct object_cb_data *data = vdata;
445
446 - if (oidset_contains(data->seen, oid))
446 + if (oidset_insert(data->seen, oid))
447 return 0;
448 - oidset_insert(data->seen, oid);
448
449 return batch_object_cb(oid, data);
450 }