File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
main/java/pl/project13/maven/git
test/java/pl/project13/maven/git Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -302,7 +302,9 @@ public void execute() throws MojoExecutionException {
302302
303303 try {
304304 properties = initProperties ();
305- prefixDot = prefix + "." ;
305+
306+ String trimmedPrefix = prefix .trim ();
307+ prefixDot = trimmedPrefix .equals ("" ) ? "" : trimmedPrefix + "." ;
306308
307309 loadGitData (properties );
308310 loadBuildTimeData (properties );
Original file line number Diff line number Diff line change @@ -111,6 +111,24 @@ public void shouldExcludeAsConfiguredProperties() throws Exception {
111111 verify (mojo ).putGitDescribe (any (Properties .class ), any (Repository .class ));
112112 }
113113
114+
115+ @ Test
116+ public void shouldHaveNoPrefixWhenConfiguredPrefixIsEmptyStringAsConfiguredProperties () throws Exception {
117+ // given
118+ mojo .setPrefix ("" );
119+
120+ // when
121+ mojo .execute ();
122+
123+ // then
124+ Properties properties = mojo .getProperties ();
125+
126+ // explicitly excluded
127+ assertThat (properties ).satisfies (new DoesNotContainKeyCondition ("git.remote.origin.url" ));
128+ assertThat (properties ).satisfies (new DoesNotContainKeyCondition (".remote.origin.url" ));
129+ assertThat (properties ).satisfies (new ContainsKeyCondition ("remote.origin.url" ));
130+ }
131+
114132 @ Test
115133 public void shouldSkipDescribeWhenConfiguredToDoSo () throws Exception {
116134 // given
You can’t perform that action at this time.
0 commit comments