summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f0298cf)
raw | patch | inline | side by side (parent: f0298cf)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 18 Jan 2009 06:27:08 +0000 (22:27 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 18 Jan 2009 07:00:31 +0000 (23:00 -0800) |
"git bundle create x master master" used to create a bundle that lists
the same branch (master) twice. Cloning from such a bundle resulted in
a needless warning "warning: Duplicated ref: refs/remotes/origin/master".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the same branch (master) twice. Cloning from such a bundle resulted in
a needless warning "warning: Duplicated ref: refs/remotes/origin/master".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bundle.c | patch | blob | history | |
object.c | patch | blob | history | |
object.h | patch | blob | history | |
t/t5701-clone-local.sh | patch | blob | history |
diff --git a/bundle.c b/bundle.c
index daecd8e1cad4a301e2faa3888c561746d029f09d..b20f2101f265786ed61e2ca08764aae249bad9d4 100644 (file)
--- a/bundle.c
+++ b/bundle.c
return error("unrecognized argument: %s'", argv[i]);
}
+ object_array_remove_duplicates(&revs.pending);
+
for (i = 0; i < revs.pending.nr; i++) {
struct object_array_entry *e = revs.pending.objects + i;
unsigned char sha1[20];
diff --git a/object.c b/object.c
index 50b6528001fe4bafdfe70126dc2078860c3d1969..7e6a92c88e7b139ec03e0ff26e97e1559a06a220 100644 (file)
--- a/object.c
+++ b/object.c
@@ -268,3 +268,22 @@ void add_object_array_with_mode(struct object *obj, const char *name, struct obj
objects[nr].mode = mode;
array->nr = ++nr;
}
+
+void object_array_remove_duplicates(struct object_array *array)
+{
+ int ref, src, dst;
+ struct object_array_entry *objects = array->objects;
+
+ for (ref = 0; ref < array->nr - 1; ref++) {
+ for (src = ref + 1, dst = src;
+ src < array->nr;
+ src++) {
+ if (!strcmp(objects[ref].name, objects[src].name))
+ continue;
+ if (src != dst)
+ objects[dst] = objects[src];
+ dst++;
+ }
+ array->nr = dst;
+ }
+}
diff --git a/object.h b/object.h
index 036bd66fe9b6591e959e6df51160e636ab1a682e..31939166382ffdd9c42d2b52983dfe1c605b9b7a 100644 (file)
--- a/object.h
+++ b/object.h
/* Object array handling .. */
void add_object_array(struct object *obj, const char *name, struct object_array *array);
void add_object_array_with_mode(struct object *obj, const char *name, struct object_array *array, unsigned mode);
+void object_array_remove_duplicates(struct object_array *);
#endif /* OBJECT_H */
diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh
index 14413f851f3e2fac478535bd706f91bf7a5781ff..fe0fda282ca4f085f506c743848966fa6bb93591 100755 (executable)
--- a/t/t5701-clone-local.sh
+++ b/t/t5701-clone-local.sh
git clone --bare . x &&
test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true &&
test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true
- git bundle create b1.bundle master HEAD &&
+ git bundle create b1.bundle --all &&
git bundle create b2.bundle master &&
mkdir dir &&
cp b1.bundle dir/b3