diff --git a/CHANGES.md b/CHANGES.md index 34044c26aa..8be1284c73 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,8 @@ This document is intended for Spotless developers. We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Fixed +* Explicitly separate target file from git arguments when parsing year for license header to prevent command from failing on argument-like paths ([#847](https://github.com/diffplug/spotless/pull/847)) ## [2.13.3] - 2021-04-20 ### Fixed diff --git a/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java b/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java index d4cbeda5b1..1e93acce31 100644 --- a/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java +++ b/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java @@ -335,7 +335,7 @@ private String setLicenseHeaderYearsFromGitHistory(String raw, File file) throws } private static String parseYear(String cmd, File file) throws IOException { - String fullCmd = cmd + " " + file.getAbsolutePath(); + String fullCmd = cmd + " -- " + file.getAbsolutePath(); ProcessBuilder builder = new ProcessBuilder().directory(file.getParentFile()); if (FileSignature.machineIsWin()) { builder.command("cmd", "/c", fullCmd); diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 697f838b54..c9ffe995a4 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -3,6 +3,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`). ## [Unreleased] +### Fixed +* Explicitly separate target file from git arguments when parsing year for license header to prevent command from failing on argument-like paths ([#847](https://github.com/diffplug/spotless/pull/847)) ## [5.12.2] - 2021-04-20 ### Fixed diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index c78170851a..517e4c6222 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -3,6 +3,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Fixed +* Explicitly separate target file from git arguments when parsing year for license header to prevent command from failing on argument-like paths ([#847](https://github.com/diffplug/spotless/pull/847)) ## [2.10.2] - 2021-04-20 ### Fixed