@@ -598,23 +598,19 @@ protected void buildTagList(File directory, boolean interactive) {
598
598
}
599
599
600
600
/*
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
607
602
* ordered.
608
603
*
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.
614
608
*
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.
618
614
*
619
615
* Linus Torvalds: [When asking] "'can commit X be an ancestor of
620
616
* commit Y' (as a way to basically limit certain algorithms from
@@ -631,8 +627,9 @@ protected void buildTagList(File directory, boolean interactive) {
631
627
* wrong, and was a hack, but avoided the need."
632
628
*
633
629
* 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."
636
633
*/
637
634
}
638
635
0 commit comments