| 2550 | }; |
| 2551 | |
| 2552 | static int get_stale_heads_cb(const struct reference *ref, void *cb_data) |
| 2553 | { |
| 2554 | struct stale_heads_info *info = cb_data; |
| 2555 | struct string_list matches = STRING_LIST_INIT_DUP; |
| 2556 | struct refspec_item query; |
| 2557 | int i, stale = 1; |
| 2558 | memset(&query, 0, sizeof(struct refspec_item)); |
| 2559 | query.dst = (char *)ref->name; |
| 2560 | |
| 2561 | refspec_find_all_matches(info->rs, &query, &matches); |
| 2562 | if (matches.nr == 0) |
| 2563 | goto clean_exit; /* No matches */ |
| 2564 | |
| 2565 | /* |
| 2566 | * If we did find a suitable refspec and it's not a symref and |
| 2567 | * it's not in the list of refs that currently exist in that |
| 2568 | * remote, we consider it to be stale. In order to deal with |
| 2569 | * overlapping refspecs, we need to go over all of the |
| 2570 | * matching refs. |
| 2571 | */ |
| 2572 | if (ref->flags & REF_ISSYMREF) |
| 2573 | goto clean_exit; |
| 2574 | |
| 2575 | for (i = 0; stale && i < matches.nr; i++) |
| 2576 | if (string_list_has_string(info->ref_names, matches.items[i].string)) |
| 2577 | stale = 0; |
| 2578 | |
| 2579 | if (stale) { |
| 2580 | struct ref *linked_ref = make_linked_ref(ref->name, &info->stale_refs_tail); |
| 2581 | oidcpy(&linked_ref->new_oid, ref->oid); |
| 2582 | } |
| 2583 | |
| 2584 | clean_exit: |
| 2585 | string_list_clear(&matches, 0); |
| 2586 | return 0; |
| 2587 | } |
| 2588 | |
| 2589 | struct ref *get_stale_heads(struct refspec *rs, struct ref *fetch_map) |
| 2590 | { |
nothing calls this directly
no test coverage detected