On Fri, 20 May 2005, Junio C Hamano wrote: > > Keep git-diff-tree output sorted in cache order on dir/file swap. No, this is wrong. Or rather, it is incomplete - it gets only a small subset of the interesting cases right. You need to really teach diff-tree about directory sorting, because it is more complicated than you think. The sorting does _not_ just affect files/directories with the same names. It affects files and directories that have the same _beginning_. The only correct way to do name sorting is the one that fsck does in "verify_order()". To realize why, you need to realize that "A" (the directory) sorts _after_ a filename "A file", because '/' sorts after ' '. In contrast, "A" (the directory) sorts _before_ "ABBA" (the band), because '/' sorts before 'B'. -- Side note: Btw, right now I depend on "memcmp()" doing comparisons as "unsigned char", which is supposed to be true, but I don't know whether it's entirely portable. So it might be that I should implement my own "namecmp()" entirely from scratch. Does anybody know if some broken system does "memcmp" ordering on signed chars? Linus - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.htmlReceived on Sat May 21 01:51:57 2005
This archive was generated by hypermail 2.1.8 : 2005-05-21 01:51:57 EST