"Shawn O. Pearce" <spearce@xxxxxxxxxxx> writes: > Junio C Hamano <gitster@xxxxxxxxx> wrote: > ... >> +/* >> + * Compare the objects in the offset order, in order to emulate the >> + * "git-rev-list --objects" output that produced the pack originally. >> + */ >> +static int ofscmp(const void *a_, const void *b_) >> +{ >> + struct in_pack_object *a = (struct in_pack_object *)a_; >> + struct in_pack_object *b = (struct in_pack_object *)b_; >> + >> + if (a->offset < b->offset) >> + return -1; >> + else if (a->offset > b->offset) >> + return 1; >> + else >> + return hashcmp(a->sha1, b->sha1); >> +} > > Really? It is not possible for two objects to be placed at the > same offset within the same packfile and yet have two different > SHA-1 values. The final else condition above is just "return 0". This actually was meant to be used to sort object entries from multiple packs together. The update to pack-objects you are commenting on deals with one packfile at a time, but I think we probably should collect from all packs and then sort (which was how merge-pack used this function). Other than that, I think your comments make sense. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html