promisor-remote: accept 0 as oid_nr in function

There are 3 callers to promisor_remote_get_direct() that first check if
the number of objects to be fetched is equal to 0. Fold that check into
promisor_remote_get_direct(), and in doing so, be explicit as to what
promisor_remote_get_direct() does if oid_nr is 0 (it returns 0, success,
immediately).

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jonathan Tan
2020-04-02 12:19:16 -07:00
committed by Junio C Hamano
parent 274b9cc253
commit db7ed7418b
5 changed files with 20 additions and 12 deletions

View File

@ -241,6 +241,9 @@ int promisor_remote_get_direct(struct repository *repo,
int to_free = 0;
int res = -1;
if (oid_nr == 0)
return 0;
promisor_remote_init();
for (r = promisors; r; r = r->next) {