4848public class DescribeCommand extends GitCommand <DescribeResult > {
4949
5050 private LoggerBridge loggerBridge ;
51+ private JGitCommon jGitCommon ;
5152
5253// TODO not yet implemented options:
5354// private boolean containsFlag = false;
@@ -122,6 +123,12 @@ public DescribeCommand withLoggerBridge(LoggerBridge bridge) {
122123 return this ;
123124 }
124125
126+ @ NotNull
127+ public DescribeCommand withJGitCommon (JGitCommon jGitCommon ) {
128+ this .jGitCommon = jGitCommon ;
129+ return this ;
130+ }
131+
125132 /**
126133 * <pre>--always</pre>
127134 *
@@ -293,7 +300,7 @@ public DescribeResult call() throws GitAPIException {
293300 }
294301
295302 // get commits, up until the nearest tag
296- List <RevCommit > commits = new JGitCommon () .findCommitsUntilSomeTag (repo , headCommit , tagObjectIdToName );
303+ List <RevCommit > commits = jGitCommon .findCommitsUntilSomeTag (repo , headCommit , tagObjectIdToName );
297304
298305 // if there is no tags or any tag is not on that branch then return generic describe
299306 if (foundZeroTags (tagObjectIdToName ) || commits .isEmpty ()) {
@@ -303,7 +310,7 @@ public DescribeResult call() throws GitAPIException {
303310
304311 // check how far away from a tag we are
305312
306- int distance = new JGitCommon () .distanceBetween (repo , headCommit , commits .get (0 ));
313+ int distance = jGitCommon .distanceBetween (repo , headCommit , commits .get (0 ));
307314 String tagName = tagObjectIdToName .get (commits .get (0 )).iterator ().next ();
308315 Pair <Integer , String > howFarFromWhichTag = Pair .of (distance , tagName );
309316
@@ -387,8 +394,8 @@ RevCommit findHeadObjectId(@NotNull Repository repo) throws RuntimeException {
387394 // git commit id -> its tag (or tags)
388395 private Map <ObjectId , List <String >> findTagObjectIds (@ NotNull Repository repo , boolean tagsFlag ) {
389396 String matchPattern = createMatchPattern ();
390- Map <ObjectId , List <DatedRevTag >> commitIdsToTags = new JGitCommon () .getCommitIdsToTags (loggerBridge , repo , tagsFlag , matchPattern );
391- Map <ObjectId , List <String >> commitIdsToTagNames = new JGitCommon () .transformRevTagsMapToDateSortedTagNames (commitIdsToTags );
397+ Map <ObjectId , List <DatedRevTag >> commitIdsToTags = jGitCommon .getCommitIdsToTags (loggerBridge , repo , tagsFlag , matchPattern );
398+ Map <ObjectId , List <String >> commitIdsToTagNames = jGitCommon .transformRevTagsMapToDateSortedTagNames (commitIdsToTags );
392399 log ("Created map: [" ,commitIdsToTagNames ,"] " );
393400
394401 return commitIdsToTagNames ;
0 commit comments