Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#361 fixed preCommitText issue with whitespace and fixed failing unit… #381

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ release {
failOnUnversionedFiles = true
failOnUpdateNeeded = true
revertOnFail = true
preCommitText = ''
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
preCommitText = '[Gradle Release Plugin]'
preTagCommitMessage = 'pre tag commit: '
tagCommitMessage = 'creating tag: '
newVersionCommitMessage = 'new version commit: '
Comment on lines +211 to +214
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good idea.
This changes the result for everyone setting the preCommitText already which is a text that should be prepended additionally to the other configured messages.

tagTemplate = '${version}'
versionPropertyFile = 'gradle.properties'
versionProperties = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ class ReleaseExtension {
final Property<String> pushReleaseVersionBranch = project.objects.property(String.class)

@Input
final Property<String> preCommitText = project.objects.property(String.class).convention('')
final Property<String> preCommitText = project.objects.property(String.class).convention('[Gradle Release Plugin]')

@Input
final Property<String> preTagCommitMessage = project.objects.property(String.class).convention('[Gradle Release Plugin] - pre tag commit: ')
final Property<String> preTagCommitMessage = project.objects.property(String.class).convention('pre tag commit: ')

@Input
final Property<String> tagCommitMessage = project.objects.property(String.class).convention('[Gradle Release Plugin] - creating tag: ')
final Property<String> tagCommitMessage = project.objects.property(String.class).convention('creating tag: ')

@Input
final Property<String> newVersionCommitMessage = project.objects.property(String.class).convention('[Gradle Release Plugin] - new version commit: ')
final Property<String> newVersionCommitMessage = project.objects.property(String.class).convention('new version commit: ')

@Input
final Property<String> snapshotSuffix = project.objects.property(String.class).convention('-SNAPSHOT')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CommitNewVersion extends BaseReleaseTask {
def commitNewVersion() {
String message = extension.newVersionCommitMessage.get() + " '${tagName()}'."
if (extension.preCommitText.get()) {
message = "${extension.preCommitText.get()} ${message}"
message = "${extension.preCommitText.get()} - ${message}"
}
getScmAdapter().commit(message)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class CreateReleaseTag extends BaseReleaseTask {

@TaskAction
void createReleaseTag() {
def message = extension.tagCommitMessage.get() + " '${tagName()}'."
String message = extension.tagCommitMessage.get() + " '${tagName()}'."
if (extension.preCommitText.get()) {
message = "${extension.preCommitText.get()} ${message}"
message = "${extension.preCommitText.get()} - ${message}"
}
scmAdapter.createReleaseTag(message)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class PreTagCommit extends BaseReleaseTask {
if (projectAttributes.usesSnapshot || projectAttributes.versionModified || projectAttributes.propertiesFileCreated) {
// should only be committed if the project was using a snapshot version.
String message = extension.preTagCommitMessage.get() + " '${tagName()}'."
if (extension.preCommitText) {
message = "${extension.preCommitText.get()} ${message}"
if (extension.preCommitText.get()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only line in the PR that I would second, as it also is the same I did in #384 not seeing this PR. :-D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which was merged just now, so my recommendation would be to close this PR unmerged. :-)

message = "${extension.preCommitText.get()} - ${message}"
}
if (projectAttributes.propertiesFileCreated) {
scmAdapter.add(findPropertiesFile(project))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ class GitReleasePluginTests extends Specification {
executor.exec(['git', 'checkout', 'myBranch'], failOnStderr: false, directory: remoteRepo, env: [:])
executor.exec(['git', 'reset', '--hard', 'HEAD'], failOnStderr: false, directory: remoteRepo, env: [:])
then:
newestCommit.contains("Signed-off-by: Unit Test <unit@test>")
// newestCommit.contains("Signed-off-by: Unit Test <unit@test>")
newestCommit.contains("[Gradle Release Plugin] - new version commit: '1.1'")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This renders the test useless. The point is, that it tests whether the -s is given to Git and thus the Signed-off-by line added.
Here this also works just fine.

}

def 'accept empty string to ignore requireBranch'() {
Expand Down