Skip to content

Commit a95f022

Browse files
committed
Provide a recommended set of format patch args
This provides an even more explicit solution to CadixDevGH-4.
1 parent 4524c7d commit a95f022

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'java-gradle-plugin'
33
id 'groovy'
44

5+
id 'maven-publish'
56
id 'com.gradle.plugin-publish' version '0.9.10'
67

78
id 'net.minecrell.licenser' version '0.4.1'
@@ -35,7 +36,7 @@ task groovydocJar(type: Jar, dependsOn: groovydoc) {
3536

3637
gradlePlugin {
3738
plugins {
38-
licenser {
39+
gitpatcher {
3940
id = 'org.cadixdev.gitpatcher'
4041
implementationClass = 'org.cadixdev.gradle.gitpatcher.GitPatcher'
4142
}
@@ -49,7 +50,7 @@ pluginBundle {
4950
tags = ['git']
5051

5152
plugins {
52-
licenserPlugin {
53+
gitpatcherPlugin {
5354
id = 'org.cadixdev.gitpatcher'
5455
displayName = 'gitpatcher'
5556
}

src/main/groovy/org/cadixdev/gradle/gitpatcher/PatchExtension.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,12 @@ class PatchExtension {
3939
*/
4040
String[] formatPatchArgs = ['--no-stat', '-N']
4141

42+
/**
43+
* Applies our recommended additional arguments for Git when formatting
44+
* patch files - currently {@code ['--zero-commit', '--full-index', '--no-signature']}.
45+
*/
46+
void recommendedFormatPatchArgs() {
47+
formatPatchArgs += ['--zero-commit', '--full-index', '--no-signature']
48+
}
49+
4250
}

src/main/groovy/org/cadixdev/gradle/gitpatcher/task/patch/MakePatchesTask.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package org.cadixdev.gradle.gitpatcher.task.patch
2525
import static java.lang.System.out
2626

2727
import org.cadixdev.gradle.gitpatcher.Git
28+
import org.gradle.api.tasks.Input
2829
import org.gradle.api.tasks.InputDirectory
2930
import org.gradle.api.tasks.InputFile
3031
import org.gradle.api.tasks.OutputDirectory
@@ -34,6 +35,7 @@ class MakePatchesTask extends PatchTask {
3435

3536
private static final Closure HUNK = { it.startsWith('@@') }
3637

38+
@Input
3739
String[] formatPatchArgs
3840

3941
@Override @InputDirectory
@@ -74,7 +76,7 @@ class MakePatchesTask extends PatchTask {
7476
}
7577

7678
def git = new Git(repo)
77-
git.format_patch(formatPatchArgs + ['-o', patchDir.absolutePath, 'origin/upstream']) >> null
79+
git.format_patch(*formatPatchArgs, '-o', patchDir.absolutePath, 'origin/upstream') >> null
7880

7981
git.repo = root
8082
git.add('-A', patchDir.absolutePath) >> out

0 commit comments

Comments
 (0)