[RFC/PATCH 3/5] fetch: trivial cleanup
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Jun 4, 2019, 02:13 UTC
- Message-ID
- <20190604021330.16130-4-felipe.contreras@gmail.com>
- In-Reply-To
- <20190604021330.16130-1-felipe.contreras@gmail.com>
Create a helper function to clear an item. The way items are cleared has changed, and will change again soon.
No functional changes.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- builtin/fetch.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c index 4ba63d5ac6..8af5e319f1 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -287,6 +287,11 @@ static int refname_hash_exists(struct hashmap *map, const char *refname) return !!hashmap_get_from_hash(map, strhash(refname), refname); } +static void clear_item(struct refname_hash_entry *item) +{ + oidclr(&item->oid); +} + static void find_non_local_tags(const struct ref *refs, struct ref **head, struct ref ***tail) @@ -319,7 +324,7 @@ static void find_non_local_tags(const struct ref *refs, !will_fetch(head, ref->old_oid.hash) && !has_object_file_with_flags(&item->oid, OBJECT_INFO_QUICK) && !will_fetch(head, item->oid.hash)) - oidclr(&item->oid); + clear_item(item); item = NULL; continue; } @@ -333,7 +338,7 @@ static void find_non_local_tags(const struct ref *refs, if (item && !has_object_file_with_flags(&item->oid, OBJECT_INFO_QUICK) && !will_fetch(head, item->oid.hash)) - oidclr(&item->oid); + clear_item(item); item = NULL; @@ -354,7 +359,7 @@ static void find_non_local_tags(const struct ref *refs, if (item && !has_object_file_with_flags(&item->oid, OBJECT_INFO_QUICK) && !will_fetch(head, item->oid.hash)) - oidclr(&item->oid); + clear_item(item); /* * For all the tags in the remote_refs_list,
-- 2.21.0