Bitbucket Server 8.0 Early Access Program (EAP) release

We encounter more issues with the GitWorkTree API.

Our Repository Templates app copies a template repository into a newly created repo. We’ve ported the code to the WorkTreeApi, and it does work on Bitbucket 7 (with small limitations)

However, when running on Bitbucket 8, the code fails with the GitWorkTree api.
The GitWorkTree api requires a ‘expectedHash’ to publish a change.
We publish to a empty repo with no commits yet, so we used a ‘all-zero’ SHA, as git tooling does accept:

    String noExistingCommit = "0000000000000000000000000000000000000000"
    newRepoWorkspace.publish(
      new PublishGitWorkTreeParameters.Builder(invoker)
        .author(author)
        .branch('master', noExistingCommit)
        .build())

This works in Bitbucket 7. However, in Bitbucket 8 it fails:

[INFO] com.atlassian.bitbucket.commit.NoSuchCommitException: Commit '0000000000000000000000000000000000000000' does not exist in repository 'b2'.
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.DefaultErrorTranslator.translateNoSuchCommit(DefaultErrorTranslator.java:325)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.DefaultErrorTranslator.translate(DefaultErrorTranslator.java:119)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.WorkTreeErrorTranslator.translateMaybeWorkTree(WorkTreeErrorTranslator.java:59)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.WorkTreeErrorTranslator.maybeTranslate(WorkTreeErrorTranslator.java:39)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver.maybeTranslate(AbstractFutureResponseObserver.java:203)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver$ResponseFuture.translateCause(AbstractFutureResponseObserver.java:292)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver$ResponseFuture.get(AbstractFutureResponseObserver.java:229)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver.asResult(AbstractFutureResponseObserver.java:145)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.PublishWorkTreeResponseObserver.asResult(PublishWorkTreeResponseObserver.java:58)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.PublishWorkTreeResponseObserver.asResult(PublishWorkTreeResponseObserver.java:14)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.AbstractFutureResponseObserver.asResult(AbstractFutureResponseObserver.java:133)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.GrpcGitWorkTreeClient.publish(GrpcGitWorkTreeClient.java:95)
[INFO]  at com.atlassian.stash.internal.scm.git.mesh.worktree.MeshGitWorkTree.publish(MeshGitWorkTree.java:146)

So, my question is, how should be publish branches into a empty repository, where there isn’t a previous commit available?

2 Likes