File tree Expand file tree Collapse file tree
src/test/java/pl/project13/maven/git Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -923,6 +923,35 @@ public void shouldExtractTagsOnGivenCommitWithOldestCommit(boolean useNativeGit)
923923 .containsOnly ("annotated-tag" , "lightweight-tag" , "newest-tag" );
924924 }
925925
926+ @ Test
927+ @ Parameters (method = "useNativeGit" )
928+ public void shouldExtractTagsOnHead (boolean useNativeGit ) throws Exception {
929+ // given
930+ mavenSandbox .withParentProject ("my-jar-project" , "jar" )
931+ .withNoChildProject ()
932+ .withGitRepoInParent (AvailableGitTestRepo .ON_A_TAG )
933+ .create ();
934+
935+ MavenProject targetProject = mavenSandbox .getParentProject ();
936+ setProjectToExecuteMojoIn (targetProject );
937+
938+ mojo .setGitDescribe (null );
939+ mojo .setUseNativeGit (useNativeGit );
940+
941+ // when
942+ mojo .execute ();
943+
944+ // then
945+ Properties properties = targetProject .getProperties ();
946+ assertGitPropertiesPresentInProject (properties );
947+
948+ assertThat (properties ).satisfies (new ContainsKeyCondition ("git.tags" ));
949+ assertThat (properties .get ("git.tags" ).toString ()).doesNotContain ("refs/tags/" );
950+
951+ assertThat (Splitter .on ("," ).split (properties .get ("git.tags" ).toString ()))
952+ .containsOnly ("v1.0.0" );
953+ }
954+
926955 @ Test
927956 @ Parameters (method = "useNativeGit" )
928957 public void runGitDescribeWithMatchOption (boolean useNativeGit ) throws Exception {
You can’t perform that action at this time.
0 commit comments