jgit/org.eclipse.jgit
Alex Spradlin b5e764abd2 RevWalk: stop mixing lines of history in topo sort
The topological sort algorithm in TopoSortGenerator for RevWalk may mix
multiple lines of history, producing results that differ from C git's
git log whose man page states: "Show no parents before all of its
children are shown, and avoid showing commits on multiple lines of
history intermixed." Lines of history are mixed because
TopoSortGenerator merely delays a commit until all of its children have
been produced; it does not immediately produce a commit after its last
child has been produced.

Therefore, when the last child of a commit has been produced, unpop the
commit so that it will be returned upon the subsequent call to next() in
TopoSortGenerator. To avoid producing duplicates, mark commits that
have not yet been produced as TOPO_QUEUED so that when a commit is
popped, it is produced if and only if TOPO_QUEUED is set.

To support nesting with other generators that may produce the same
commit multiple times like DepthGenerator (for example, StartGenerator
does this), do not increment parent inDegree for the same child commit
more than once.

Modify tests that assert that TopoSortGenerator mixes lines of commit
history.

Change-Id: I4ee03c7a8e5265d61230b2a01ae3858745b2432b
Signed-off-by: Alex Spradlin <alexaspradlin@google.com>
2020-02-18 15:17:23 -08:00
..
.settings Merge branch 'stable-5.6' into stable-5.7 2020-02-01 02:09:37 +01:00
META-INF Prepare 5.7.0-SNAPSHOT builds 2020-01-15 22:15:27 +01:00
findBugs [findBugs] Silence warning about Transport initialization 2012-09-14 00:01:47 +02:00
resources Merge branch 'stable-5.7' 2020-02-01 02:17:49 +01:00
src/org/eclipse/jgit RevWalk: stop mixing lines of history in topo sort 2020-02-18 15:17:23 -08:00
.classpath Change JGit minimum execution environment to JavaSE-1.8 2016-09-20 11:32:36 +02:00
.fbprefs
.gitignore
.project Revert "Hide Maven target directories from Eclipse" 2010-08-28 09:50:50 +02:00
BUILD Merge branch 'stable-5.4' into stable-5.5 2019-09-08 17:35:14 +02:00
about.html SHA-1: collision detection support 2017-02-28 16:38:43 -08:00
build.properties
plugin.properties Fix bundle localization of Apache SSH bundle 2019-06-21 17:54:06 +02:00
pom.xml Prepare 5.7.0-SNAPSHOT builds 2020-01-15 22:15:27 +01:00