100644 255988a47f56bfa9364c6aff54e45de252b376b8 1 Makefile 100644 07c421bd266724b966fdc92cbc24ef77d61c0d48 2 Makefile 100644 a538710ed6b53079f85582c83be11ae414380d15 3 Makefile 100644 fad39ff609f3ea27981e7a9ffdfc29731d1065d0 1 upload-pack.c 100644 bbd6bd60b52d806be0a69324009755f49b070082 2 upload-pack.c 100644 e8f4be373cfd0ce03617c5fa1494bf52d4babc6c 3 upload-pack.c diff --cc Makefile index 07c421b,a538710..0000000 --- a/Makefile +++ b/Makefile @@@ -253,7 -242,7 +253,11 @@@ server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \ tag.o tree.o usage.o config.o environment.o ctype.o copy.o \ fetch-clone.o revision.o pager.o tree-walk.o xdiff-interface.o \ ++<<<<<<< HEAD/Makefile + alloc.o merge-file.o path-list.o unpack-trees.o help.o $(DIFF_OBJS) ++======= + alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) ++>>>>>>> 937a515a15f776aa84430574f71367292a52b978/Makefile BUILTIN_OBJS = \ builtin-add.o \ diff --cc upload-pack.c index bbd6bd6,e8f4be3..0000000 --- a/upload-pack.c +++ b/upload-pack.c @@@ -327,7 -334,7 +334,11 @@@ if (get_sha1_hex(hex, sha1)) die("git-upload-pack: expected SHA1 object, got '%s'", hex); if (!has_sha1_file(sha1)) ++<<<<<<< HEAD/upload-pack.c + return 0; ++======= + return -1; ++>>>>>>> 937a515a15f776aa84430574f71367292a52b978/upload-pack.c o = lookup_object(sha1); if (!(o && o->parsed)) @@@ -343,8 -354,73 +358,76 @@@ parents; parents = parents->next) parents->item->object.flags |= THEY_HAVE; ++<<<<<<< HEAD/upload-pack.c ++======= + } + if (!we_knew_they_have) { + add_object_array(o, NULL, &have_obj); + return 1; + } + return 0; + } + + static int reachable(struct commit *want) + { + struct commit_list *work = NULL; + + insert_by_date(want, &work); + while (work) { + struct commit_list *list = work->next; + struct commit *commit = work->item; + free(work); + work = list; + + if (commit->object.flags & THEY_HAVE) { + want->object.flags |= COMMON_KNOWN; + break; + } + if (!commit->object.parsed) + parse_object(commit->object.sha1); + if (commit->object.flags & REACHABLE) + continue; + commit->object.flags |= REACHABLE; + if (commit->date < oldest_have) + continue; + for (list = commit->parents; list; list = list->next) { + struct commit *parent = list->item; + if (!(parent->object.flags & REACHABLE)) + insert_by_date(parent, &work); + } + } + want->object.flags |= REACHABLE; + clear_commit_marks(want, REACHABLE); + free_commit_list(work); + return (want->object.flags & COMMON_KNOWN); + } + + static int ok_to_give_up(void) + { + int i; + + if (!have_obj.nr) + return 0; + + for (i = 0; i < want_obj.nr; i++) { + struct object *want = want_obj.objects[i].item; + + if (want->flags & COMMON_KNOWN) + continue; + want = deref_tag(want, "a want line", 0); + if (!want || want->type != OBJ_COMMIT) { + /* no way to tell if this is reachable by + * looking at the ancestry chain alone, so + * leave a note to ourselves not to worry about + * this object anymore. + */ + want_obj.objects[i].item->flags |= COMMON_KNOWN; + continue; + } + if (!reachable((struct commit *)want)) + return 0; ++>>>>>>> 937a515a15f776aa84430574f71367292a52b978/upload-pack.c } - add_object_array(o, NULL, &have_obj); return 1; }