Skip to content

Commit a8363b5

Browse files
felipecgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8144f09 commit a8363b5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

builtin/fetch.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ static int refname_hash_exists(struct hashmap *map, const char *refname)
285285
return !!hashmap_get_from_hash(map, strhash(refname), refname);
286286
}
287287

288+
static void clear_item(struct refname_hash_entry *item)
289+
{
290+
oidclr(&item->oid);
291+
}
292+
288293
static void find_non_local_tags(const struct ref *refs,
289294
struct ref **head,
290295
struct ref ***tail)
@@ -318,7 +323,7 @@ static void find_non_local_tags(const struct ref *refs,
318323
!has_sha1_file_with_flags(item->oid.hash,
319324
OBJECT_INFO_QUICK) &&
320325
!will_fetch(head, item->oid.hash))
321-
oidclr(&item->oid);
326+
clear_item(item);
322327
item = NULL;
323328
continue;
324329
}
@@ -332,7 +337,7 @@ static void find_non_local_tags(const struct ref *refs,
332337
if (item &&
333338
!has_sha1_file_with_flags(item->oid.hash, OBJECT_INFO_QUICK) &&
334339
!will_fetch(head, item->oid.hash))
335-
oidclr(&item->oid);
340+
clear_item(item);
336341

337342
item = NULL;
338343

@@ -353,7 +358,7 @@ static void find_non_local_tags(const struct ref *refs,
353358
if (item &&
354359
!has_sha1_file_with_flags(item->oid.hash, OBJECT_INFO_QUICK) &&
355360
!will_fetch(head, item->oid.hash))
356-
oidclr(&item->oid);
361+
clear_item(item);
357362

358363
/*
359364
* For all the tags in the remote_refs_list,

0 commit comments

Comments
 (0)