summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b5a06e)
raw | patch | inline | side by side (parent: 2b5a06e)
author | Daniel Barkalow <barkalow@iabervon.org> | |
Mon, 8 Oct 2007 04:25:07 +0000 (00:25 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 16 Oct 2007 00:28:06 +0000 (20:28 -0400) |
If multiple refspecs matched the same ref, the update would be
processed multiple times. Now having the same destination for the same
source has no additional effect, and having the same destination for
different sources is an error.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
processed multiple times. Now having the same destination for the same
source has no additional effect, and having the same destination for
different sources is an error.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
builtin-fetch.c | patch | blob | history | |
remote.c | patch | blob | history | |
remote.h | patch | blob | history |
diff --git a/builtin-fetch.c b/builtin-fetch.c
index cf7498b15fe91e2d138f384fa304c7f4e90f454d..caaca63644b91b414d808079e14aee38c2a6eda7 100644 (file)
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
ref_map->merge = 1;
}
}
+ ref_remove_duplicates(ref_map);
return ref_map;
}
diff --git a/remote.c b/remote.c
index e7d735b98af231610c460c7aa34f12cdd6f37460..e2ca4d32bab79f2d3795fa8cbc6a70906c672f0e 100644 (file)
--- a/remote.c
+++ b/remote.c
return result;
}
+void ref_remove_duplicates(struct ref *ref_map)
+{
+ struct ref **posn;
+ struct ref *next;
+ for (; ref_map; ref_map = ref_map->next) {
+ if (!ref_map->peer_ref)
+ continue;
+ posn = &ref_map->next;
+ while (*posn) {
+ if ((*posn)->peer_ref &&
+ !strcmp((*posn)->peer_ref->name,
+ ref_map->peer_ref->name)) {
+ if (strcmp((*posn)->name, ref_map->name))
+ die("%s tracks both %s and %s",
+ ref_map->peer_ref->name,
+ (*posn)->name, ref_map->name);
+ next = (*posn)->next;
+ free((*posn)->peer_ref);
+ free(*posn);
+ *posn = next;
+ } else {
+ posn = &(*posn)->next;
+ }
+ }
+ }
+}
+
int remote_has_url(struct remote *remote, const char *url)
{
int i;
diff --git a/remote.h b/remote.h
index 05add06e48c0e759230b3384a6828851170ded67..c62636d78ef996b97aef73cf37cfb5de3f279145 100644 (file)
--- a/remote.h
+++ b/remote.h
*/
void free_refs(struct ref *ref);
+/*
+ * Removes and frees any duplicate refs in the map.
+ */
+void ref_remove_duplicates(struct ref *ref_map);
+
struct refspec *parse_ref_spec(int nr_refspec, const char **refspec);
int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,