guitarrapc / git-shallow-clone-orb

circleci orb to execute git shallow clone for faster checkout.
https://circleci.com/orbs/registry/orb/guitarrapc/git-shallow-clone
MIT License
21 stars 11 forks source link

Bug: shallow checkout if the branch has moved too much foward #63

Open pcorpet opened 6 days ago

pcorpet commented 6 days ago

Is there an existing issue for this?

Orb version

2.5.0

Current behavior

I use the simple checkout command in my job:

steps:
  - git-shallow-clone/checkout

It is part of a workflow that springs on my main branch and is gated by an approval in Circle CI which allows me to start this workflow only on some commits of my branch. However if I try to approve it for an older commit, then the shallow clone fails.

I believe it should not try to start the fetch from the current branch, but from the Circle SHA1, or maybe at least add an option where one can checkout only the code at CIRCLE_SHA1 version without caring about the branch anymore.

Minimum reproduction config

---
version: 2.1
orbs:
  git-shallow-clone: guitarrapc/git-shallow-clone@2.5.0
workflows:
  release:
    jobs:
      - manual-approval:
          only-on-branch: main
          type: approval
          filters:
            branches:
              only:
                - main
      - start-release:
          requires: manual-approval
  jobs:
    start-release:
      executor: python/default
      steps:
        - git-shallow-clone/checkout

Add this config above, then create 20+ additional commits on the main branch, then go back in CircleCI to approve the "manual-approval" job of the release workflow for an old commit of the main branch.

Other

No response