jgit/org.eclipse.jgit
Dmitrii Filippov 1e04046a6d Fix crashes on rare combination of file names
The NameConflictTreeWalk class is used in merge for iterating over
entries in commits. The class uses a separate iterator for each
commit's tree. In rare cases it can incorrectly report the same entry
twice. As a result, duplicated entries are added to the merge result
and later jgit throws an exception when it tries to process merge
result.

The problem appears only when there is a directory-file conflict for
the last item in trees. Example from the bug:
Commit 1:
* subtree - file
* subtree-0 - file
Commit 2:
* subtree - directory
* subtree-0 - file
Here the names are ordered like this:
"subtree" file <"subtree-0" file < "subtree" directory.

The NameConflictTreeWalk handles similar cases correctly if there are
other files after subtree... in commits - this is processed in the
AbstractTreeIterator.min function. Existing code has a special
optimization for the case, when all trees are pointed to the same
entry name - it skips additional checks. However, this optimization
incorrectly skips checks if one of trees reached the end.

The fix processes a situation when some trees reached the end, while
others are still point to an entry.

bug: 535919
Change-Id: I62fde3dd89779fac282479c093400448b4ac5c86
2022-11-03 14:09:56 -04:00
..
.settings PushCommand: allow users to disable use of bitmaps for push 2022-10-21 08:11:33 +02:00
META-INF Prepare 6.4.0-SNAPSHOT builds 2022-09-14 13:56:40 +02:00
findBugs [spotbugs] Silence NP_BOOLEAN_RETURN_NULL in IgnoreNode#checkIgnored 2020-12-22 10:52:59 +01:00
resources/org/eclipse/jgit Split out ApplyCommand logic to PatchApplier class 2022-09-15 09:15:55 +02:00
src/org/eclipse/jgit Fix crashes on rare combination of file names 2022-11-03 14:09:56 -04:00
.classpath Bump minimum required Java version to 11 2021-09-29 17:12:12 +02:00
.fbprefs
.gitignore
.project
BUILD Squash error-prone messages 2022-08-01 15:47:20 +02:00
about.html
build.properties
plugin.properties Fix bundle localization of Apache SSH bundle 2019-06-21 17:54:06 +02:00
pom.xml Prepare 6.4.0-SNAPSHOT builds 2022-09-14 13:56:40 +02:00