Skip to content

Commit ac3fa2b

Browse files
committed
Disable GPG signing in gitpatcher repositories
1 parent 2273806 commit ac3fa2b

File tree

8 files changed

+21
-14
lines changed

8 files changed

+21
-14
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212
}
1313

1414
group = 'net.minecrell'
15-
version = '0.9-SNAPSHOT'
15+
version = '0.8.1-SNAPSHOT'
1616
description = 'A Gradle plugin to manage patches for Git repositories'
1717

1818
sourceCompatibility = 1.6

src/main/groovy/net/minecrell/gitpatcher/Git.groovy

+11-8
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class Git {
3636
}
3737

3838
String getStatus() {
39-
return run('status', ['-z']) as String
39+
return run('status', ['-z']).text
4040
}
4141

4242
String getRef() {
43-
return (rev_parse('HEAD') as String).readLines().first().trim()
43+
return rev_parse('HEAD').text.readLines().first().trim()
4444
}
4545

4646
Command run(String name, Object input) {
@@ -92,12 +92,15 @@ class Git {
9292
def rightShift = this.&writeTo
9393
def rightShiftUnsigned = this.&forceWriteTo
9494

95-
Object asType(Class type) {
96-
if (type == String) {
97-
setup(null, System.err)
98-
execute()
99-
return process.inputStream.text
100-
}
95+
String getText() {
96+
setup(null, System.err)
97+
execute()
98+
return process.inputStream.text.trim()
99+
}
100+
101+
String readText() {
102+
setup(null, System.err)
103+
return run() == 0 ? process.inputStream.text.trim() : null;
101104
}
102105

103106
}

src/main/groovy/net/minecrell/gitpatcher/GitPatcher.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
package net.minecrell.gitpatcher
2424

25-
import net.minecrell.gitpatcher.task.UpdateSubmodulesTask
2625
import net.minecrell.gitpatcher.task.FindGitTask
26+
import net.minecrell.gitpatcher.task.UpdateSubmodulesTask
2727
import net.minecrell.gitpatcher.task.patch.ApplyPatchesTask
2828
import net.minecrell.gitpatcher.task.patch.MakePatchesTask
2929
import org.gradle.api.Plugin

src/main/groovy/net/minecrell/gitpatcher/task/FindGitTask.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class FindGitTask extends DefaultTask {
3434
void findGit() {
3535
def git = new Git(project.rootDir)
3636
try {
37-
def version = (git.version() as String).readLines().join(', ')
37+
def version = git.version().text.readLines().join(', ')
3838
logger.lifecycle("Using $version for patching submodule $submodule.")
3939
} catch (Throwable e) {
4040
throw new UnsupportedOperationException(

src/main/groovy/net/minecrell/gitpatcher/task/UpdateSubmodulesTask.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class UpdateSubmodulesTask extends SubmoduleTask {
3434
@TaskAction
3535
void updateSubmodules() {
3636
def git = new Git(repo)
37-
def result = git.submodule('status', '--', submodule) as String
37+
def result = git.submodule('status', '--', submodule).text
3838

3939
this.ref = result[1 .. result.indexOf(' ', 1) - 1]
4040

src/main/groovy/net/minecrell/gitpatcher/task/patch/ApplyPatchesTask.groovy

+5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ class ApplyPatchesTask extends PatchTask {
8686
assert patchDir.mkdirs(), 'Failed to create patch directory'
8787
}
8888

89+
if ('true'.equalsIgnoreCase(git.config('commit.gpgsign').readText())) {
90+
logger.warn("Disabling GPG signing for the gitpatcher repository")
91+
git.config('commit.gpgsign', 'false') >> out
92+
}
93+
8994
def patches = this.patches
9095
if (patches.length > 0) {
9196
logger.lifecycle 'Applying patches from {} to {}', patchDir, repo

src/main/groovy/net/minecrell/gitpatcher/task/patch/MakePatchesTask.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class MakePatchesTask extends PatchTask {
7979

8080
didWork = false
8181
for (def patch : patches) {
82-
def diff = (git.diff('--no-color', '-U1', '--staged', patch.absolutePath) as String).readLines()
82+
def diff = git.diff('--no-color', '-U1', '--staged', patch.absolutePath).text.readLines()
8383

8484
boolean upToDate = false
8585

src/main/groovy/net/minecrell/gitpatcher/task/patch/PatchTask.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
package net.minecrell.gitpatcher.task.patch
2424

25-
import com.google.common.collect.ImmutableList
2625
import net.minecrell.gitpatcher.task.SubmoduleTask
2726

2827
abstract class PatchTask extends SubmoduleTask {

0 commit comments

Comments
 (0)