| 878 | } |
| 879 | |
| 880 | static void handle_duplicate(struct ref *ref1, struct ref *ref2) |
| 881 | { |
| 882 | if (strcmp(ref1->name, ref2->name)) { |
| 883 | if (ref1->fetch_head_status != FETCH_HEAD_IGNORE && |
| 884 | ref2->fetch_head_status != FETCH_HEAD_IGNORE) { |
| 885 | die(_("Cannot fetch both %s and %s to %s"), |
| 886 | ref1->name, ref2->name, ref2->peer_ref->name); |
| 887 | } else if (ref1->fetch_head_status != FETCH_HEAD_IGNORE && |
| 888 | ref2->fetch_head_status == FETCH_HEAD_IGNORE) { |
| 889 | warning(_("%s usually tracks %s, not %s"), |
| 890 | ref2->peer_ref->name, ref2->name, ref1->name); |
| 891 | } else if (ref1->fetch_head_status == FETCH_HEAD_IGNORE && |
| 892 | ref2->fetch_head_status == FETCH_HEAD_IGNORE) { |
| 893 | die(_("%s tracks both %s and %s"), |
| 894 | ref2->peer_ref->name, ref1->name, ref2->name); |
| 895 | } else { |
| 896 | /* |
| 897 | * This last possibility doesn't occur because |
| 898 | * FETCH_HEAD_IGNORE entries always appear at |
| 899 | * the end of the list. |
| 900 | */ |
| 901 | BUG("Internal error"); |
| 902 | } |
| 903 | } |
| 904 | free(ref2->peer_ref); |
| 905 | free(ref2); |
| 906 | } |
| 907 | |
| 908 | struct ref *ref_remove_duplicates(struct ref *ref_map) |
| 909 | { |
no test coverage detected