Search code examples
gitcontinuous-integrationsalesforcebitbucket-pipelinesdelta

Problem with sha pointer ["error": "--from is not a valid sha pointer: \"origin/master\"",]


I want to deploy only changed files (according to documentation: https://github.com/scolladon/sfdx-git-delta)

I add to bitbucket-pipelines.yml:

- mkdir changed-sources
- git status
- git diff YMLEdit origin/master
- sfdx sgd:source:delta --to "HEAD" -f origin/master --output changed-sources/ --generate-delta

without git diff i receive an error:

sfdx sgd:source:delta --to "HEAD" -f origin/master --output changed-sources/ --generate-delta
{
"error": "--from is not a valid sha pointer: \"origin/master\"",
"output": "changed-sources/",
"success": false,
"warnings": []

}

When I add git diff i receive this:

+ git diff YMLEdit origin/master
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Any ideas?

I tried using diffrent docker image I tried using git fetch


Solution

  • Bitbucket is probably running your pipeline in a shallow, single-branch clone, so that there is no origin/master.

    Solution, that worked for me, following @torek's suggestion and this documentation: https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/#clone

    I add to bitbucket-pipelines.yml:

    clone:
      depth: full
    
    pipelines:
      default:
        # ...