ratchetFrom 'origin/main' does not fetch if not present
- Dominant language
- Java
- Stars
- 5.6k
- Forks
- 559
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 43
Description
If you specify `rachetFrom` and the branch doesn't exist locally, it should be fetched by the ratchet infrastructure.
https://github.com/JLLeitschuh/spotless/runs/1200916598?check_suite_focus=true#step:5:56
```
[2020-10-02 21:07:06] [autobuild] * What went wrong:
[2020-10-02 21:07:06] [autobuild] A problem occurred evaluating project ':ide'.
[2020-10-02 21:07:06] [autobuild] > Could not create task ':lib:spotlessJava'.
[2020-10-02 21:07:06] [autobuild] > No such reference 'origin/main'
```
### EDIT: Summary of workarounds from below
- **GitHub Actions**: add `fetch-depth: 0` to `.yml`
- **GitLab CI**: add `GIT_DEPTH: 0` under the `variables:` section of `.gitlab-ci.yml`
- **BitBucket Pipelines**: `clone: depth: full`
- **Travis**: `git: depth: false`
Contributor guide
Research direction
Start with the ratchetFrom handling in the ratchet infrastructure and reproduce the failure using a checkout where origin/main is not present locally. Trace how the reference is resolved, then verify that specifying ratchetFrom can obtain the missing branch and no longer reports “No such reference 'origin/main'” in CI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100