Fix merges involving subtrees with StrategySimpleTwoWayInCore
commitaa917184ee8f6bdff3e7154dcd95d12e0d7b2a58
authorShawn O. Pearce <spearce@spearce.org>
Fri, 6 Mar 2009 01:05:23 +0000 (5 17:05 -0800)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sat, 7 Mar 2009 00:10:04 +0000 (7 01:10 +0100)
tree26507c32d049c4c1aad3072039f6822afefd3070
parent5aaed94e487d1bc633f503bfdd692f5697ade123
Fix merges involving subtrees with StrategySimpleTwoWayInCore

JGit mismerged two trees when the common ancestor tree contained two
trees named libelf-po and libelf, and libelf was modified on one side
of the merge, while libelf-po was unmodified by both:

  040000 tree ...    libelf-po
  040000 tree ...    libelf

Above is the correct sort order, as the second tree, libelf, must be
sorted as though it ends with '/', and thus comes after libelf-po.

JGit flipped the order during a merge as the strategy added the modified
subtree "libelf" directly to the DirCacheBuilder, rather than unfolding
its contents into the DirCache.  The result was a tree entry where only
file type entries were expected, and the DirCacheBuilder resorted its
contents to place "libelf" before "libelf-po".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit.test/tst/org/spearce/jgit/merge/SimpleMergeTest.java
org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheBuilder.java
org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java