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

Leading space inserted for title of pre tag commit #361

Open
tueda opened this issue Jul 25, 2022 · 3 comments · May be fixed by #384
Open

Leading space inserted for title of pre tag commit #361

tueda opened this issue Jul 25, 2022 · 3 comments · May be fixed by #384

Comments

@tueda
Copy link

tueda commented Jul 25, 2022

Somehow ./gradlew release inserted a leading space to the commit title for pre tag commit. This occurred to me with

Gradle 7.5
net.researchgate.release 3.0.0

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.14 (Ubuntu 11.0.14+9-Ubuntu-0ubuntu2.20.04)
OS:           Linux 5.10.102.1-microsoft-standard-WSL2 amd64

Downgrading the version 3.0.0 to 2.8.1 fixes the issue, i.e., no leading space inserted, see the image below.

image

I think this must be reproducible if one uses my repo and runs ./gradlew release, though it is totally unclear to me why this could happen. It seems that GitHub/GitLab interface ignores such leading spaces in commit titles, so one should use git log to see them.

@peetkes
Copy link

peetkes commented Jun 30, 2023

we also ran into this while we setup workflow rules on skipping commits which started with '[Gradle Release Plugin]'. The pre tag commit slipped through because of the leading space.

@pschyska
Copy link

pschyska commented Jun 30, 2023

Is that extra space from here?:

message = "${extension.preCommitText.get()} ${message}"

Our preCommitText is empty, and we get the leading space in the commit message as well.

@peetkes
Copy link

peetkes commented Jun 30, 2023

That seems a logic explanation. Would it make sense to check if preCommitText if empty before prepending it to the message? Maybe the preCommitText should contain [Gradle Release Plugin] and change the other ones like below:

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

    @Input
    final Property<String> preTagCommitMessage = project.objects.property(String.class).convention('pre tag commit: ')

    @Input
    final Property<String> tagCommitMessage = project.objects.property(String.class).convention('creating tag: ')

    @Input
    final Property<String> newVersionCommitMessage = project.objects.property(String.class).convention('new version commit: ')

peetkes pushed a commit to peetkes/gradle-release that referenced this issue Jun 30, 2023
…failing unitTest for GitReleasePluginTests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants