@@ -873,13 +873,15 @@ public static function buildLog($a, $b = 'HEAD') {
873
873
return true ;
874
874
});
875
875
876
- // sort tags
876
+ // sort tags older DESCENDING
877
877
usort ($ tags , function ($ a , $ b ) {
878
- return version_compare ($ a , $ b );
878
+ return version_compare ($ b , $ a );
879
879
});
880
880
881
881
$ log = [];
882
- $ tags [] = $ b ;
882
+ if ($ b === '"Unreleaased ' ) {
883
+ array_unshift ($ tags , $ b );
884
+ }
883
885
$ startRef = array_shift ($ tags );
884
886
while ($ endRef = array_shift ($ tags )) {
885
887
$ log = array_merge ($ log , self ::buildLogOneBump ($ startRef , $ endRef ));
@@ -903,7 +905,7 @@ public static function buildLogOneBump($a, $b) {
903
905
$ remote = $ remotes ['origin ' ];
904
906
905
907
// Get all commits from A to B
906
- $ commits = Git::createCommitList (Git::getLog ($ a , $ b ));
908
+ $ commits = Git::createCommitList (Git::getLog ($ b , $ a ));
907
909
908
910
// Remove non conventional commits
909
911
$ commits = self ::filterCommits ($ commits );
@@ -930,13 +932,14 @@ public static function buildLogOneBump($a, $b) {
930
932
$ log = [];
931
933
932
934
$ tagDate = (new DateTime ())->format ('Y-m-d ' );
933
- $ compare = "$ remote/compare/ $ a .. " ;
935
+ $ compare = "$ remote/compare/ " ;
934
936
if ($ tag !== 'Unreleased ' ) {
935
937
$ tagDate = Git::getTagDate ($ tag )->format ('Y-m-d ' );
936
938
$ compare .= $ tag ;
937
939
} else {
938
940
$ compare .= Git::getCurrentBranch ();
939
941
}
942
+ $ compare .= ".. $ a " ;
940
943
$ log [] = '<a name=" ' . $ tag . '"></a> ' ;
941
944
$ log [] = '## [ ' . $ tag . ']( ' . $ compare . ') ( ' . $ tagDate . ') ' ;
942
945
$ log [] = '' ;
0 commit comments