@@ -966,14 +966,9 @@ private Map<String, Supplier<String>> generateGlobalFormatPlaceholderMap(GitSitu
966966 placeholderMap .put ("describe.tag.version.label.next" , Lazy .by (() -> increase (placeholderMap .get ("describe.tag.version.label" ).get (), 1 )));
967967
968968 final Lazy <Integer > descriptionDistance = Lazy .by (() -> description .get ().getDistance ());
969- placeholderMap .put ("describe.distance" , Lazy .by (() -> String .valueOf (descriptionDistance .get ())));
970- placeholderMap .put ("describe.distance.snapshot" , Lazy .by (() -> (descriptionDistance .get () == 0 ? "" : "-SNAPSHOT" )));
971-
972- placeholderMap .put ("describe.tag.version.patch.plus.describe.distance" , Lazy .by (() -> increase (placeholderMap .get ("describe.tag.version.patch" ).get (), descriptionDistance .get ())));
973- placeholderMap .put ("describe.tag.version.patch.next.plus.describe.distance" , Lazy .by (() -> increase (placeholderMap .get ("describe.tag.version.patch.next" ).get (), descriptionDistance .get ())));
974-
975- placeholderMap .put ("describe.tag.version.label.plus.describe.distance" , Lazy .by (() -> increase (placeholderMap .get ("describe.tag.version.label" ).get (), descriptionDistance .get ())));
976- placeholderMap .put ("describe.tag.version.label.next.plus.describe.distance" , Lazy .by (() -> increase (placeholderMap .get ("describe.tag.version.label.next" ).get (), descriptionDistance .get ())));
969+ setDescribeDistancePlaceholders (placeholderMap , descriptionDistance , "distance" );
970+ final Lazy <Integer > descriptionDistanceOrZero = Lazy .by (() -> description .get ().getDistanceOrZero ());
971+ setDescribeDistancePlaceholders (placeholderMap , descriptionDistanceOrZero , "distanceOrZero" );
977972
978973 // describe tag pattern groups
979974 final Lazy <Map <String , String >> describeTagPatternValues = Lazy .by (
@@ -1002,6 +997,17 @@ private Map<String, Supplier<String>> generateGlobalFormatPlaceholderMap(GitSitu
1002997 return placeholderMap ;
1003998 }
1004999
1000+ private static void setDescribeDistancePlaceholders (Map <String , Supplier <String >> placeholderMap , Lazy <Integer > descriptionDistance , String distanceName ) {
1001+ placeholderMap .put ("describe." + distanceName , Lazy .by (() -> String .valueOf (descriptionDistance .get ())));
1002+ placeholderMap .put ("describe." + distanceName + ".snapshot" , Lazy .by (() -> (descriptionDistance .get () == 0 ? "" : "-SNAPSHOT" )));
1003+
1004+ placeholderMap .put ("describe.tag.version.patch.plus.describe." + distanceName , Lazy .by (() -> increase (placeholderMap .get ("describe.tag.version.patch" ).get (), descriptionDistance .get ())));
1005+ placeholderMap .put ("describe.tag.version.patch.next.plus.describe." + distanceName , Lazy .by (() -> increase (placeholderMap .get ("describe.tag.version.patch.next" ).get (), descriptionDistance .get ())));
1006+
1007+ placeholderMap .put ("describe.tag.version.label.plus.describe." + distanceName , Lazy .by (() -> increase (placeholderMap .get ("describe.tag.version.label" ).get (), descriptionDistance .get ())));
1008+ placeholderMap .put ("describe.tag.version.label.next.plus.describe." + distanceName , Lazy .by (() -> increase (placeholderMap .get ("describe.tag.version.label.next" ).get (), descriptionDistance .get ())));
1009+ }
1010+
10051011 private Matcher matchVersion (String input ) {
10061012 Matcher matcher = VERSION_PATTERN .matcher (input );
10071013 //noinspection ResultOfMethodCallIgnored
0 commit comments