Skip to content

Commit 9528b80

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

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

builtin/fetch.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,19 +366,21 @@ static void find_non_local_tags(const struct ref *refs,
366366
*/
367367
for_each_string_list_item(remote_ref_item, &remote_refs_list) {
368368
const char *refname = remote_ref_item->string;
369+
struct ref *rm;
369370

370371
item = hashmap_get_from_hash(&remote_refs, strhash(refname), refname);
371372
if (!item)
372373
BUG("unseen remote ref?");
373374

374375
/* 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;
382384
}
383385
hashmap_free(&remote_refs, 1);
384386
string_list_clear(&remote_refs_list, 0);

0 commit comments

Comments
 (0)