From db7ed7418b3702ab2b2df755764c3f452917a890 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Thu, 2 Apr 2020 12:19:16 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- promisor-remote.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'promisor-remote.c') diff --git a/promisor-remote.c b/promisor-remote.c index 9f338c945f..2155dfe657 100644 --- a/promisor-remote.c +++ b/promisor-remote.c @@ -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) { -- cgit v1.2.1