Skip to content

Commit

Permalink
Merge pull request #284 from ajoberstar/close
Browse files Browse the repository at this point in the history
Work for grgit 3.1.0
  • Loading branch information
ajoberstar committed Mar 23, 2019
2 parents b2c1fec + c1c4d1a commit eafe6a0
Show file tree
Hide file tree
Showing 24 changed files with 119 additions and 106 deletions.
17 changes: 2 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ jobs:
<<: *defaults
docker:
- image: ajoberstar/circleci-openjdk-gradle:8-jdk
build-java-9:
<<: *defaults
docker:
- image: ajoberstar/circleci-openjdk-gradle:9-jdk
build-java-10:
<<: *defaults
docker:
- image: ajoberstar/circleci-openjdk-gradle:10-jdk
build-java-11:
<<: *defaults
docker:
Expand Down Expand Up @@ -77,18 +69,13 @@ workflows:
jobs:
- build-java-8:
<<: *branches-and-tags
- build-java-9:
<<: *branches-and-tags
requires:
- build-java-8
- build-java-10:
- build-java-11:
<<: *branches-and-tags
requires:
- build-java-8
- publish:
<<: *tags-only
requires:
- build-java-8
- build-java-9
- build-java-10
- build-java-11
context: ajoberstar
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'org.ajoberstar.defaults' version '0.12.0'
id 'org.jbake.site' version '1.4.0'
id 'org.ajoberstar.defaults' version '0.14.2'
id 'org.jbake.site' version '5.0.0'
}

apply from: 'gradle/locking.gradle'
Expand Down Expand Up @@ -33,7 +33,6 @@ allprojects {

jbake {
srcDirName = 'docs'
asciidoctorjVersion = '1.5.8.1'
}

gitPublish {
Expand Down
5 changes: 4 additions & 1 deletion docs/content/grgit-push.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ grgit.push()
[source, groovy]
----
grgit.push(remote: '<name or uri>', refsOrSpecs: [<ref or refspec>, ...],
all: <boolean>, tags: <boolean>, force: <boolean>, dryRun: <boolean>)
all: <boolean>, tags: <boolean>, force: <boolean>, dryRun: <boolean>),
pushOptions: [<string>, ...]
----

[source, groovy]
Expand All @@ -29,6 +30,7 @@ grgit.push {
tags = <boolean>
force = <boolean>
dryRun = <boolean>
pushOptions = [<string>, ...]
}
----

Expand Down Expand Up @@ -58,6 +60,7 @@ all:: (`boolean`, default `false`) Push all branches (i.e. refs under `refs/head
tags:: (`boolean`, default `false`) All refs under refs/tags are pushed, in addition to refspecs explicitly listed in `refsOrSpecs`.
force:: (`boolean`, default `false`) Usually, the command refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. Note that `force` applies to all the refs that are pushed, hence using it with `push.default` set to `matching` or with multiple push destinations configured with `remote.*.push` may overwrite refs other than the current branch (including local refs that are strictly behind their remote counterpart). To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch). See the <refspec>... section above for details.
dryRun:: (`boolean`, default `false`) Do everything except actually send the updates.
pushOptions:: (`List<String>`, default `[]`) Transmit the given string to the server, which passes them to the pre-receive as well as the post-receive hook. The given string must not contain a NUL or LF character. When multiple `pushOptions` are given, they are all sent to the other side in the order listed. When no `pushOptions` is given, the values of configuration variable `push.pushOption` are used instead.

== Examples

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions grgit-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {

dependencies {
// groovy
compileOnly 'org.codehaus.groovy:groovy-all:[2.5.0, 2.6.0-alpha)'
compileOnly 'org.codehaus.groovy:groovy:[2.5.0, 2.6.0-alpha)'

// jgit
api 'org.eclipse.jgit:org.eclipse.jgit:latest.release'
Expand All @@ -22,7 +22,7 @@ dependencies {

// testing
testImplementation 'junit:junit:latest.release'
testImplementation 'org.spockframework:spock-core:1.2-groovy-2.5'
testImplementation 'org.spockframework:spock-core:1.3-groovy-2.5'
}

jar {
Expand Down
42 changes: 5 additions & 37 deletions grgit-core/gradle/dependency-locks/compileClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,9 @@
com.googlecode.javaewah:JavaEWAH:1.1.6
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
com.thoughtworks.qdox:qdox:1.12.1
commons-cli:commons-cli:1.4
info.picocli:picocli:3.7.0
jline:jline:2.14.6
junit:junit:4.12
org.apache.ant:ant-launcher:1.9.13
org.apache.ant:ant:1.9.13
org.apiguardian:apiguardian-api:1.0.0
org.codehaus.groovy:groovy-all:2.5.4
org.codehaus.groovy:groovy-ant:2.5.4
org.codehaus.groovy:groovy-cli-commons:2.5.4
org.codehaus.groovy:groovy-cli-picocli:2.5.4
org.codehaus.groovy:groovy-console:2.5.4
org.codehaus.groovy:groovy-datetime:2.5.4
org.codehaus.groovy:groovy-docgenerator:2.5.4
org.codehaus.groovy:groovy-groovydoc:2.5.4
org.codehaus.groovy:groovy-groovysh:2.5.4
org.codehaus.groovy:groovy-jmx:2.5.4
org.codehaus.groovy:groovy-json:2.5.4
org.codehaus.groovy:groovy-jsr223:2.5.4
org.codehaus.groovy:groovy-macro:2.5.4
org.codehaus.groovy:groovy-nio:2.5.4
org.codehaus.groovy:groovy-servlet:2.5.4
org.codehaus.groovy:groovy-sql:2.5.4
org.codehaus.groovy:groovy-swing:2.5.4
org.codehaus.groovy:groovy-templates:2.5.4
org.codehaus.groovy:groovy-test-junit5:2.5.4
org.codehaus.groovy:groovy-test:2.5.4
org.codehaus.groovy:groovy-testng:2.5.4
org.codehaus.groovy:groovy-xml:2.5.4
org.codehaus.groovy:groovy:2.5.4
org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
org.hamcrest:hamcrest-core:1.3
org.junit.platform:junit-platform-commons:1.3.1
org.junit.platform:junit-platform-engine:1.3.1
org.junit.platform:junit-platform-launcher:1.3.1
org.opentest4j:opentest4j:1.1.1
org.bouncycastle:bcpg-jdk15on:1.60
org.bouncycastle:bcpkix-jdk15on:1.60
org.bouncycastle:bcprov-jdk15on:1.60
org.codehaus.groovy:groovy:2.5.6
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r
org.slf4j:slf4j-api:1.7.2
5 changes: 4 additions & 1 deletion grgit-core/gradle/dependency-locks/runtimeClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
com.googlecode.javaewah:JavaEWAH:1.1.6
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
org.bouncycastle:bcpg-jdk15on:1.60
org.bouncycastle:bcpkix-jdk15on:1.60
org.bouncycastle:bcprov-jdk15on:1.60
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r
org.slf4j:slf4j-api:1.7.2
27 changes: 15 additions & 12 deletions grgit-core/gradle/dependency-locks/testCompileClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
com.googlecode.javaewah:JavaEWAH:1.1.6
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
junit:junit:4.12
org.codehaus.groovy:groovy-json:2.5.2
org.codehaus.groovy:groovy-macro:2.5.2
org.codehaus.groovy:groovy-nio:2.5.2
org.codehaus.groovy:groovy-sql:2.5.2
org.codehaus.groovy:groovy-templates:2.5.2
org.codehaus.groovy:groovy-test:2.5.2
org.codehaus.groovy:groovy-xml:2.5.2
org.codehaus.groovy:groovy:2.5.2
org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
junit:junit:4.13-beta-2
org.bouncycastle:bcpg-jdk15on:1.60
org.bouncycastle:bcpkix-jdk15on:1.60
org.bouncycastle:bcprov-jdk15on:1.60
org.codehaus.groovy:groovy-json:2.5.4
org.codehaus.groovy:groovy-macro:2.5.4
org.codehaus.groovy:groovy-nio:2.5.4
org.codehaus.groovy:groovy-sql:2.5.4
org.codehaus.groovy:groovy-templates:2.5.4
org.codehaus.groovy:groovy-test:2.5.4
org.codehaus.groovy:groovy-xml:2.5.4
org.codehaus.groovy:groovy:2.5.4
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r
org.hamcrest:hamcrest-core:1.3
org.slf4j:slf4j-api:1.8.0-beta2
org.spockframework:spock-core:1.2-groovy-2.5
org.slf4j:slf4j-api:1.8.0-beta4
org.spockframework:spock-core:1.3-groovy-2.5
29 changes: 16 additions & 13 deletions grgit-core/gradle/dependency-locks/testRuntimeClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
com.googlecode.javaewah:JavaEWAH:1.1.6
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
junit:junit:4.12
org.codehaus.groovy:groovy-json:2.5.2
org.codehaus.groovy:groovy-macro:2.5.2
org.codehaus.groovy:groovy-nio:2.5.2
org.codehaus.groovy:groovy-sql:2.5.2
org.codehaus.groovy:groovy-templates:2.5.2
org.codehaus.groovy:groovy-test:2.5.2
org.codehaus.groovy:groovy-xml:2.5.2
org.codehaus.groovy:groovy:2.5.2
org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
junit:junit:4.13-beta-2
org.bouncycastle:bcpg-jdk15on:1.60
org.bouncycastle:bcpkix-jdk15on:1.60
org.bouncycastle:bcprov-jdk15on:1.60
org.codehaus.groovy:groovy-json:2.5.4
org.codehaus.groovy:groovy-macro:2.5.4
org.codehaus.groovy:groovy-nio:2.5.4
org.codehaus.groovy:groovy-sql:2.5.4
org.codehaus.groovy:groovy-templates:2.5.4
org.codehaus.groovy:groovy-test:2.5.4
org.codehaus.groovy:groovy-xml:2.5.4
org.codehaus.groovy:groovy:2.5.4
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r
org.hamcrest:hamcrest-core:1.3
org.slf4j:slf4j-api:1.8.0-beta2
org.slf4j:slf4j-simple:1.8.0-beta2
org.spockframework:spock-core:1.2-groovy-2.5
org.slf4j:slf4j-api:1.8.0-beta4
org.slf4j:slf4j-simple:1.8.0-beta4
org.spockframework:spock-core:1.3-groovy-2.5
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ class LogOp implements Callable<List<Commit>> {
ResolveService resolve = new ResolveService(repo)
def toObjectId = { rev ->
String revstr = resolve.toRevisionString(rev)
JGitUtil.resolveRevObject(repo, revstr, true).id
def id = JGitUtil.resolveRevObject(repo, revstr, true)
if (id) {
return id
} else {
throw new IllegalArgumentException("\"${revstr}\" cannot be resolved to an object in this repository.")
}
}

includes.collect(toObjectId).each { object ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ class PushOp implements Callable<Void> {
*/
boolean dryRun = false

/**
* The push options to send to the receiving remote
*/
List pushOptions = []

PushOp(Repository repo) {
this.repo = repo
}
Expand All @@ -69,6 +74,9 @@ class PushOp implements Callable<Void> {
if (tags) { cmd.setPushTags() }
cmd.force = force
cmd.dryRun = dryRun
if (pushOptions) {
cmd.pushOptions = pushOptions
}

def failures = []
cmd.call().each { result ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ class JGitUtil {
*/
static RevObject resolveRevObject(Repository repo, String revstr, boolean peel = false) {
ObjectId id = resolveObject(repo, revstr)
RevWalk walk = new RevWalk(repo.jgit.repository)
RevObject rev = walk.parseAny(id)
return peel ? walk.peel(rev) : rev
if (id) {
RevWalk walk = new RevWalk(repo.jgit.repository)
RevObject rev = walk.parseAny(id)
return peel ? walk.peel(rev) : rev
} else {
return null
}
}

/**
Expand Down Expand Up @@ -102,7 +106,9 @@ class JGitUtil {
static Commit convertCommit(Repository repo, RevCommit rev) {
Map props = [:]
props.id = ObjectId.toString(rev)
props.abbreviatedId = repo.jgit.repository.newObjectReader().abbreviate(rev).name()
repo.jgit.repository.newObjectReader().withCloseable { reader ->
props.abbreviatedId = reader.abbreviate(rev).name()
}
PersonIdent committer = rev.committerIdent
props.committer = new Person(committer.name, committer.emailAddress)
PersonIdent author = rev.authorIdent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ class LogOpSpec extends SimpleGitOpSpec {
} == [4, 3, 1].collect(intToCommit)
}

def 'log with non-existing commit fails'() {
when:
grgit.log(includes: ['garbage', intToCommit(1)])
then:
thrown(IllegalArgumentException)
}

def 'log with path includes only commits with changes for that path'() {
expect:
grgit.log(paths:['2.txt']).collect { it.id } == [5, 0].collect(intToCommit).collect { it.id }
Expand Down
3 changes: 2 additions & 1 deletion grgit-gradle/.stutter/java11.lock
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# DO NOT MODIFY: Generated by Stutter plugin.
5.0-rc-2
5.0
5.3
5 changes: 3 additions & 2 deletions grgit-gradle/.stutter/java8.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
3.0
3.5.1
4.0
4.10.2
5.0-rc-2
4.10.3
5.0
5.3
5 changes: 3 additions & 2 deletions grgit-gradle/.stutter/java9.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# DO NOT MODIFY: Generated by Stutter plugin.
4.2.1
4.10.2
5.0-rc-2
4.10.3
5.0
5.3
2 changes: 1 addition & 1 deletion grgit-gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {
compatTestImplementation project(':grgit-core')

compatTestCompile 'junit:junit:latest.release'
compatTestCompile 'org.spockframework:spock-core:1.1-groovy-2.4'
compatTestCompile 'org.spockframework:spock-core:1.3-groovy-2.5'
}

jar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
com.googlecode.javaewah:JavaEWAH:1.1.6
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
junit:junit:4.12
org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
junit:junit:4.13-beta-2
org.bouncycastle:bcpg-jdk15on:1.60
org.bouncycastle:bcpkix-jdk15on:1.60
org.bouncycastle:bcprov-jdk15on:1.60
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r
org.hamcrest:hamcrest-core:1.3
org.slf4j:slf4j-api:1.7.2
org.spockframework:spock-core:1.1-groovy-2.4
org.spockframework:spock-core:1.3-groovy-2.5
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
com.googlecode.javaewah:JavaEWAH:1.1.6
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
junit:junit:4.12
org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
junit:junit:4.13-beta-2
org.bouncycastle:bcpg-jdk15on:1.60
org.bouncycastle:bcpkix-jdk15on:1.60
org.bouncycastle:bcprov-jdk15on:1.60
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r
org.hamcrest:hamcrest-core:1.3
org.slf4j:slf4j-api:1.7.2
org.spockframework:spock-core:1.1-groovy-2.4
org.spockframework:spock-core:1.3-groovy-2.5
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
com.googlecode.javaewah:JavaEWAH:1.1.6
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
org.bouncycastle:bcpg-jdk15on:1.60
org.bouncycastle:bcpkix-jdk15on:1.60
org.bouncycastle:bcprov-jdk15on:1.60
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r
org.slf4j:slf4j-api:1.7.2
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
com.googlecode.javaewah:JavaEWAH:1.1.6
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
org.bouncycastle:bcpg-jdk15on:1.60
org.bouncycastle:bcpkix-jdk15on:1.60
org.bouncycastle:bcprov-jdk15on:1.60
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r
org.slf4j:slf4j-api:1.7.2
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
com.googlecode.javaewah:JavaEWAH:1.1.6
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
org.eclipse.jgit:org.eclipse.jgit:5.1.3.201810200350-r
org.bouncycastle:bcpg-jdk15on:1.60
org.bouncycastle:bcpkix-jdk15on:1.60
org.bouncycastle:bcprov-jdk15on:1.60
org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r
org.slf4j:slf4j-api:1.7.2
Loading

0 comments on commit eafe6a0

Please sign in to comment.