mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
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>
This commit is contained in:
parent
0750bb5b51
commit
ced9fff75d
1 changed files with 1 additions and 2 deletions
|
@ -443,9 +443,8 @@ static int batch_unordered_object(const struct object_id *oid, void *vdata)
|
||||||
{
|
{
|
||||||
struct object_cb_data *data = vdata;
|
struct object_cb_data *data = vdata;
|
||||||
|
|
||||||
if (oidset_contains(data->seen, oid))
|
if (oidset_insert(data->seen, oid))
|
||||||
return 0;
|
return 0;
|
||||||
oidset_insert(data->seen, oid);
|
|
||||||
|
|
||||||
return batch_object_cb(oid, data);
|
return batch_object_cb(oid, data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue