Corrected tree entry sorting.
commit0057bd6a1d80e85bdc01c71a491bc78d7afc417c
authorShawn O. Pearce <spearce@spearce.org>
Mon, 7 Aug 2006 06:11:04 +0000 (7 02:11 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 7 Aug 2006 06:11:04 +0000 (7 02:11 -0400)
tree9b4d1e0277d3fb0a0523070c7907696250939786
parent48f701eee2dfd808565ef13acebd4509258d0fab
Corrected tree entry sorting.

Core GIT sorts subtrees into their parent tree as though their names
end in '/', as this is how they are sorted within the index file.
Unfortunately jgit didn't sort like this, which meant it was unable
to read some trees as it would determine the tree was misorted, or
it would write corrupt trees.

This change maintains the tree in memory sorted by name without the
trailing '/'.  Therefore the tree is resorted upon loading it into
memory or just before writing it out as a loose object.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java
org.spearce.jgit/src/org/spearce/jgit/lib/SubtreeSorter.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/lib/Tree.java
org.spearce.jgit/src/org/spearce/jgit/lib/TreeEntry.java
org.spearce.jgit/tst/org/spearce/jgit/lib_tst/T0002_Tree.java
org.spearce.jgit/tst/org/spearce/jgit/lib_tst/T0003_Basic.java