gradle-git-publish icon indicating copy to clipboard operation
gradle-git-publish copied to clipboard

Could not evaluate onlyIf predicate for task ':myproject:gitPublishPush'. > Cannot get property 'trackingBranch' on null object

Open ghost opened this issue 6 years ago • 4 comments

Task :myproject:gitPublishReset Task :myproject:javadoc UP-TO-DATE Task :myproject:gitPublishCopy NO-SOURCE Task :myproject:gitPublishCommit UP-TO-DATE Task :myproject:gitPublishPush FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Could not evaluate onlyIf predicate for task ':myproject:gitPublishPush'.

Cannot get property 'trackingBranch' on null object

Having issue on 2.1.1 version

ghost avatar Sep 06 '19 11:09 ghost

I don't believe we're accessing tracking branch anymore. But feel free to reopen if this is still happening

ajoberstar avatar Feb 10 '22 03:02 ajoberstar

I'm getting the same error with version 4.1.1 and grgit 5.0.0 https://github.com/SimonIT/spriter/runs/8285846438?check_suite_focus=true#step:4:220 The error appears only after a "clean"

SimonIT avatar Sep 10 '22 16:09 SimonIT

@SimonIT I tried reproducing that error with your project and can't get it to fail that way (either locally on Debian or in Actions). It does appear that there's a bug in Grgit that causes the NPE, but it doesn't explain why the branch is missing since it should have been created in gitPublishReset.

I also noticed an unrelated mistake in your build.gradle. Instead of gitPublishCommit.dependsOn publish it should be gitPublishCopy.dependsOn publish. This is why you were getting a NO SOURCE result for the copy task as the artifacts had been published to the build/mvn dir yet.

If you can find a way to reproduce this again, can you capture a --debug log?

ajoberstar avatar Sep 11 '22 22:09 ajoberstar

I tried recreating the error with the same steps, but wasn't able to. Not sure what changed it

SimonIT avatar Sep 12 '22 10:09 SimonIT