aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2019-06-03 21:13:28 -0500
committerJunio C Hamano <gitster@pobox.com>2019-06-04 11:28:58 -0700
commita8363b57193ea3e881367ff06035d4a2fe021d59 (patch)
tree69dbc0dda446a768fd8ed7c935a09048a58e3c5c /builtin/fetch.c
parentt5801 (remote-helpers): add test to fetch tags (diff)
downloadgit-a8363b57193ea3e881367ff06035d4a2fe021d59.tar.gz
git-a8363b57193ea3e881367ff06035d4a2fe021d59.zip
fetch: trivial cleanup
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index aee1d9bf21..547b25d206 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -285,6 +285,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)
@@ -318,7 +323,7 @@ static void find_non_local_tags(const struct ref *refs,
!has_sha1_file_with_flags(item->oid.hash,
OBJECT_INFO_QUICK) &&
!will_fetch(head, item->oid.hash))
- oidclr(&item->oid);
+ clear_item(item);
item = NULL;
continue;
}
@@ -332,7 +337,7 @@ static void find_non_local_tags(const struct ref *refs,
if (item &&
!has_sha1_file_with_flags(item->oid.hash, OBJECT_INFO_QUICK) &&
!will_fetch(head, item->oid.hash))
- oidclr(&item->oid);
+ clear_item(item);
item = NULL;
@@ -353,7 +358,7 @@ static void find_non_local_tags(const struct ref *refs,
if (item &&
!has_sha1_file_with_flags(item->oid.hash, OBJECT_INFO_QUICK) &&
!will_fetch(head, item->oid.hash))
- oidclr(&item->oid);
+ clear_item(item);
/*
* For all the tags in the remote_refs_list,