0

I want to add the changes of one branch to other branch in the same repo. I am not sure if that means merging the first branch into second.So, I tried this

def grgit = org.ajoberstar.grgit.Grgit.open(dir: project.parent.projectDir)
    grgit.checkout(branch: 'test_dest')
    grgit.fetch()
    grgit.merge(head: 'master')
    grgit.push()

But when I execute the task, I get an error ' No commit found for revision string'. Any pointers, how can I make this work

enter image description here

stacktrace :

Caused by: org.ajoberstar.grgit.exception.GrgitException: No commit found for revision string: test_dest
    at org.ajoberstar.grgit.util.JGitUtil.resolveObject(JGitUtil.groovy:62)
    at org.ajoberstar.grgit.util.JGitUtil$resolveObject$0.call(Unknown Source)
    at org.ajoberstar.grgit.operation.MergeOp.call(MergeOp.groovy:84)
    at org.ajoberstar.grgit.operation.MergeOp.call(MergeOp.groovy)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at org.ajoberstar.grgit.util.OpSyntaxUtil.tryOp(OpSyntaxUtil.groovy:45)
    at org.ajoberstar.grgit.Grgit.methodMissing(Grgit.groovy:188)
    at com.vitalconnect.gradle.tasks.PushChangesTask.pushToDest(PushChangesTask.groovy:28)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 60 more
sver
  • 866
  • 1
  • 19
  • 44

2 Answers2

0

No commit found for revision string: HEAD I was getting this issue. I had done git init, but had not committed or pushed to repository. So I was getting this error.

Then I committed and pushed to correct branch and then this error vanished.

Sumant
  • 496
  • 1
  • 6
  • 20
0

For future googlers

I'm start to using semantic-release and my project use tags in this format: 1.0.0

The project stopped to build and was given me that message:

> Could not resolve all dependencies for configuration ':project-name:classpath'.
   > No commit found for revision string: v1.0.0^{commit}

That is because the default tag format accepted by this gradle plugin is v1.0.0

The solution was pretty simple. Just put the below code in your build.gradle

release {
    tagStrategy {
        prefixNameWithV = false
    }
}
jpozorio
  • 622
  • 6
  • 7