Spotless's `spotlessSetLicenseHeaderYearsFromGitHistory`: Unable to parse date from command
- Vorherrschende Sprache
- Java
- Sterne
- 5.6k
- Forks
- 559
- Ø Merge
- 1 T. 14 Std.
- Gemergte PRs (30 T.)
- 43
Beschreibung
If you are submitting a **bug**, please include the following:
- [x] summary of problem
- Using the `-PspotlessSetLicenseHeaderYearsFromGitHistory=true` parameter to generate license headers with the creation year of the file, spotless fails to successful run the task
- [x] Gradle or Maven version
- Gradle 8.4
- Java Eclipse Temurin 17.0.10
- Git 2.44.0.windows.1
- [x] spotless version
- spotless 6.25.0
- spotless-lib-extra 2.45.0
- [x] operating system and version
- Windows 11 Pro 23H2 22635.3430
- [x] copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
- All spotless related changes can be seen here in the PR for my project. -> https://github.com/IntelligenceModding/AdvancedPeripherals/pull/579
- [x] copy-paste the full content of any console errors emitted by `gradlew spotless[Apply/Check] --stacktrace`
A small portion:
```
Unable to parse date from command 'git log --follow --find-renames=40% --reverse -- C:\Users\info\IdeaProjects\AdvancedPeripherals\src\main\java\de\srendi\advancedperipherals\common\addons\computercraft\owner\IOwnerAbility.java':
java.lang.IllegalArgumentException: Unable to parse date from command 'git log --follow --find-renames=40% --reverse -- C:\Users\info\IdeaProjects\AdvancedPeripherals\src\main\java\de\srendi\advancedperipherals\common\addons\computercraft\owner\I
OwnerAbility.java':
at com.diffplug.spotless.generic.LicenseHeaderStep$Runtime.parseYear(LicenseHeaderStep.java:467)
```
Full log: https://gist.github.com/SirEndii/e0ed12833caec97f39e9c14935a0ad0f
The full command I'm trying to use `gradlew spotless[Apply/Check] -PspotlessSetLicenseHeaderYearsFromGitHistory=true`
When I try to use the git log command, it only works without the `--follow` parameter. I am not too familiar with the `git log` command to know exactly what the issue could be. This also happens when I try to use different java files from the project

Beitragsleitfaden
Rechercherichtung
Beginne bei com.diffplug.spotless.generic.LicenseHeaderStep.parseYear, angegeben in LicenseHeaderStep.java:467, und reproduziere das Problem mit Gradle 8.4 unter Windows unter Verwendung von spotlessSetLicenseHeaderYearsFromGitHistory=true. Vergleiche den gemeldeten git log-Befehl mit und ohne --follow; abgeschlossen ist die Aufgabe, wenn der Spotless-Task erfolgreich abgeschlossen wird und das Erstellungsjahr der Datei korrekt bestimmt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- git, java
- Bereich
- build-system, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100