Skip to content

Commit 8595159

Browse files
idodeclareVladimir Kotal
authored andcommitted
Fix comment
1 parent 490cfa3 commit 8595159

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/GitRepository.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -598,23 +598,19 @@ protected void buildTagList(File directory, boolean interactive) {
598598
}
599599

600600
/*
601-
* Note that the former algorithm ran `git tag` first. `git tag` lists
602-
* tags in lexicographic order, so the former algorithm with its final
603-
* reverse() would have produced a result that was reverse-
604-
* lexicographically ordered.
605-
*
606-
* Repository technically relies on the tag list to be reverse-ancestor
601+
* Repository technically relies on the tag list to be ancestor
607602
* ordered.
608603
*
609-
* This algorithm by using `git log --tags` results in reverse-ancestor
610-
* order. But there is also a technicality that Repository
611-
* searches ancestry by using TagEntry.compareTo(HistoryEntry). For
612-
* an SCM that uses "linear revision numbering" (e.g. SVN or Mercurial),
613-
* the search is reliable.
604+
* For an SCM that uses "linear revision numbering" (e.g. Subversion or
605+
* Mercurial), the natural ordering in the TreeSet is by ancestor order
606+
* and so TagEntry.compareTo(HistoryEntry) always determines the
607+
* correct tag.
614608
*
615-
* For GitTagEntry.compareTo(HistoryEntry) that compares by date, the
616-
* search can technically terminate too early if ancestor-order is not
617-
* monotonic by date (which Git allows with no complaint).
609+
* For GitTagEntry that does not use linear revision numbering, the
610+
* TreeSet will be ordered by date. That does not necessarily align
611+
* with ancestor order. In that case,
612+
* GitTagEntry.compareTo(HistoryEntry) that compares by date can find
613+
* the wrong tag.
618614
*
619615
* Linus Torvalds: [When asking] "'can commit X be an ancestor of
620616
* commit Y' (as a way to basically limit certain algorithms from
@@ -631,8 +627,9 @@ protected void buildTagList(File directory, boolean interactive) {
631627
* wrong, and was a hack, but avoided the need."
632628
*
633629
* If Git ever gets standard generation numbers,
634-
* GitTagEntry.compareTo() should be revised to work reliably akin to
635-
* an SCM that uses "linear revision numbering."
630+
* GitTagEntry.compareTo(HistoryEntry) should be revised to work
631+
* reliably in all cases akin to an SCM that uses "linear revision
632+
* numbering."
636633
*/
637634
}
638635

0 commit comments

Comments
 (0)