-
Notifications
You must be signed in to change notification settings - Fork 304
Closed
Milestone
Description
Describe the bug
As discussed in
#395 (comment)
the property <evaluateOnCommit>HEAD</evaluateOnCommit>
should allow everything like HEAD
, HEAD^1
or a specific branch name (e.g. branch
). However when setting it to a specific branch name the git.branch
will always be the full commit-id (which is the right fall back when the branch can not be determined -- e.g. detached HEAD).
Steps to Reproduce
@Test
@Parameters(method = "useNativeGit")
public void verifyEvalOnDifferentCommitWithCommitHash(boolean useNativeGit) throws Exception {
// given
mavenSandbox.withParentProject("my-jar-project", "jar")
.withNoChildProject()
.withGitRepoInParent(AvailableGitTestRepo.WITH_TAG_ON_DIFFERENT_BRANCH)
.create();
MavenProject targetProject = mavenSandbox.getParentProject();
setProjectToExecuteMojoIn(targetProject);
GitDescribeConfig gitDescribe = createGitDescribeConfig(true, 9);
gitDescribe.setDirty(null);
mojo.gitDescribe = gitDescribe;
mojo.useNativeGit = useNativeGit;
mojo.evaluateOnCommit = "test";
// when
mojo.execute();
// then
assertPropertyPresentAndEqual(targetProject.getProperties(), "git.commit.id.abbrev", "9cb810e");
assertPropertyPresentAndEqual(targetProject.getProperties(), "git.commit.id.describe", "test_tag-0-g9cb810e57");
assertPropertyPresentAndEqual(targetProject.getProperties(), "git.branch", "test");
assertPropertyPresentAndEqual(targetProject.getProperties(), "git.tags", "test_tag");
assertPropertyPresentAndEqual(targetProject.getProperties(), "git.dirty", "true");
assertPropertyPresentAndEqual(targetProject.getProperties(), "git.total.commit.count", "2");
}
Expected behavior
- Tests should pass
Additional context
For reproducibility please provide the following:
Metadata
Metadata
Assignees
Labels
No labels