fetch: make the code more understandable
The comment makes it seem as if the condition is the other way around. The exception is when the oid is null, so check for that. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Jun 3, 2019 at 21:13 UTC
9528b80b1a269540e12c95346f0c4b06a27dc37c
1 file changed
+9
-7
builtin/fetch.c
+9
-7
@@ -366,19 +366,21 @@ static void find_non_local_tags(const struct ref *refs,
366
*/
367
for_each_string_list_item(remote_ref_item, &remote_refs_list) {
368
const char *refname = remote_ref_item->string;
369
+ struct ref *rm;
370
371
item = hashmap_get_from_hash(&remote_refs, strhash(refname), refname);
372
if (!item)
373
BUG("unseen remote ref?");
374
375
/* Unless we have already decided to ignore this item... */
375
- if (!is_null_oid(&item->oid)) {
376
- struct ref *rm = alloc_ref(item->refname);
377
- rm->peer_ref = alloc_ref(item->refname);
378
- oidcpy(&rm->old_oid, &item->oid);
379
- **tail = rm;
380
- *tail = &rm->next;
381
- }
376
+ if (is_null_oid(&item->oid))
377
+ continue;
378
+
379
+ rm = alloc_ref(item->refname);
380
+ rm->peer_ref = alloc_ref(item->refname);
381
+ oidcpy(&rm->old_oid, &item->oid);
382
+ **tail = rm;
383
+ *tail = &rm->next;
384
}
385
hashmap_free(&remote_refs, 1);
386
string_list_clear(&remote_refs_list, 0);