Skip to content

Commit f66aaf5

Browse files
authored
Add information about using ratchetFrom on CI systems (#1770)
2 parents 19b7c2d + 16f41e7 commit f66aaf5

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

plugin-gradle/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,13 @@ However, we strongly recommend that you use a non-local branch, such as a tag or
13701370
13711371
This is especially helpful for injecting accurate copyright dates using the [license step](#license-header).
13721372
1373+
### Using `ratchetFrom` on CI systems
1374+
1375+
Many popular CI systems (GitHub, GitLab, BitBucket, and Travis) use a "shallow clone". This means that `ratchetFrom 'origin/main'` will fail with `No such reference`. You can fix this by:
1376+
1377+
- calling `git fetch origin main` before you call Spotless
1378+
- disabling the shallow clone [like so](https://github.com/diffplug/spotless/issues/710)
1379+
13731380
## `spotless:off` and `spotless:on`
13741381
13751382
Sometimes there is a chunk of code which you have carefully handcrafted, and you would like to exclude just this one little part from getting clobbered by the autoformat. Some formatters have a way to do this, many don't, but who cares. If you setup your spotless like this:

plugin-maven/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,13 @@ You can explicitly disable ratchet functionality by providing the value 'NONE':
15421542
```
15431543
This is useful for disabling the ratchet functionality in child projects where the parent defines a ratchetFrom value.
15441544

1545+
### Using `ratchetFrom` on CI systems
1546+
1547+
Many popular CI systems (GitHub, GitLab, BitBucket, and Travis) use a "shallow clone". This means that `<ratchetFrom>origin/main</ratchetFrom>` will fail with `No such reference`. You can fix this by:
1548+
1549+
- calling `git fetch origin main` before you call Spotless
1550+
- disabling the shallow clone [like so](https://github.com/diffplug/spotless/issues/710)
1551+
15451552
## `spotless:off` and `spotless:on`
15461553

15471554
Sometimes there is a chunk of code which you have carefully handcrafted, and you would like to exclude just this one little part from getting clobbered by the autoformat. Some formatters have a way to do this, many don't, but who cares. If you setup your spotless like this:

0 commit comments

Comments
 (0)