diff options
Diffstat (limited to 'builtin-fetch.c')
-rw-r--r-- | builtin-fetch.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c index a58efa6ece..26c3d74b76 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -459,6 +459,17 @@ static int add_existing(const char *refname, const unsigned char *sha1, 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) @@ -495,7 +506,8 @@ static void find_non_local_tags(struct transport *transport, 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); |