diff --git a/builtin-fetch.c b/builtin-fetch.c
index a58efa6ece78a66cf807a80b96198d08e2e2ea0b..26c3d74b76de701a8e1a5e0c7031751599c1487f 100644 (file)
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
return 0;
}
+static int will_fetch(struct ref **head, const unsigned char *sha1)
+{
+ struct ref *rm = *head;
+ while (rm) {
+ if (!hashcmp(rm->old_sha1, sha1))
+ return 1;
+ rm = rm->next;
+ }
+ return 0;
+}
+
static void find_non_local_tags(struct transport *transport,
struct ref **head,
struct ref ***tail)
if (!path_list_has_path(&existing_refs, ref_name) &&
!path_list_has_path(&new_refs, ref_name) &&
- has_sha1_file(ref->old_sha1)) {
+ (has_sha1_file(ref->old_sha1) ||
+ will_fetch(head, ref->old_sha1))) {
path_list_insert(ref_name, &new_refs);
rm = alloc_ref(strlen(ref_name) + 1);