Updates jgit to 5.12.0.202106070339-r
Also includes org.eclipse.jgit.ssh.jsch artifact. Fixes gh-1881
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<name>spring-cloud-config-dependencies</name>
|
||||
<description>Spring Cloud Config Dependencies</description>
|
||||
<properties>
|
||||
<jgit.version>5.1.3.201810200350-r</jgit.version>
|
||||
<jgit.version>5.12.0.202106070339-r</jgit.version>
|
||||
<spring-vault.version>2.3.2</spring-vault.version>
|
||||
<spring-credhub.version>2.1.1.RELEASE</spring-credhub.version>
|
||||
</properties>
|
||||
@@ -66,6 +66,11 @@
|
||||
<artifactId>org.eclipse.jgit.http.apache</artifactId>
|
||||
<version>${jgit.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
<artifactId>org.eclipse.jgit.ssh.jsch</artifactId>
|
||||
<version>${jgit.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
|
||||
@@ -76,6 +76,10 @@
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
<artifactId>org.eclipse.jgit.http.apache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
<artifactId>org.eclipse.jgit.ssh.jsch</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.assertj.core.api.Assertions;
|
||||
@@ -557,13 +558,8 @@ public class JGitEnvironmentRepositoryTests {
|
||||
FetchCommand fetchCommand = mock(FetchCommand.class);
|
||||
when(git.fetch()).thenReturn(fetchCommand);
|
||||
when(fetchCommand.setRemote(anyString())).thenReturn(fetchCommand);
|
||||
when(fetchCommand.call()).thenThrow(new InvalidRemoteException("invalid mock remote")); // here
|
||||
// is
|
||||
// our
|
||||
// exception
|
||||
// we
|
||||
// are
|
||||
// testing
|
||||
// here is our exception we are testing
|
||||
when(fetchCommand.call()).thenThrow(new InvalidRemoteException("invalid mock remote"));
|
||||
|
||||
// refresh()->checkout
|
||||
CheckoutCommand checkoutCommand = mock(CheckoutCommand.class);
|
||||
@@ -580,18 +576,13 @@ public class JGitEnvironmentRepositoryTests {
|
||||
// refresh()->merge
|
||||
MergeCommand mergeCommand = mock(MergeCommand.class);
|
||||
when(git.merge()).thenReturn(mergeCommand);
|
||||
when(mergeCommand.call()).thenThrow(new NotMergedException()); // here
|
||||
// is
|
||||
// our
|
||||
// exception
|
||||
// we
|
||||
// are
|
||||
// testing
|
||||
// here is our exception we are testing
|
||||
when(mergeCommand.call()).thenThrow(new NotMergedException());
|
||||
|
||||
// refresh()->return
|
||||
// git.getRepository().findRef("HEAD").getObjectId().getName();
|
||||
Ref headRef = mock(Ref.class);
|
||||
when(this.database.getRef(anyString())).thenReturn(headRef);
|
||||
when(this.database.findRef(anyString())).thenReturn(headRef);
|
||||
|
||||
ObjectId newObjectId = ObjectId.fromRaw(new int[] { 1, 2, 3, 4, 5 });
|
||||
when(headRef.getObjectId()).thenReturn(newObjectId);
|
||||
@@ -604,11 +595,19 @@ public class JGitEnvironmentRepositoryTests {
|
||||
|
||||
private Repository stubbedRepo() {
|
||||
return spy(new Repository(new BaseRepositoryBuilder()) {
|
||||
|
||||
private String id = UUID.randomUUID().toString();
|
||||
|
||||
@Override
|
||||
public void create(boolean bare) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectDatabase getObjectDatabase() {
|
||||
return null;
|
||||
@@ -695,7 +694,7 @@ public class JGitEnvironmentRepositoryTests {
|
||||
|
||||
// refresh()->return git.getRepository().findRef("HEAD").getObjectId().getName();
|
||||
Ref headRef = mock(Ref.class);
|
||||
when(this.database.getRef(anyString())).thenReturn(headRef);
|
||||
when(this.database.findRef(anyString())).thenReturn(headRef);
|
||||
|
||||
ObjectId newObjectId = ObjectId.fromRaw(new int[] { 1, 2, 3, 4, 5 });
|
||||
when(headRef.getObjectId()).thenReturn(newObjectId);
|
||||
@@ -804,13 +803,8 @@ public class JGitEnvironmentRepositoryTests {
|
||||
// refresh()->merge
|
||||
MergeCommand mergeCommand = mock(MergeCommand.class);
|
||||
when(git.merge()).thenReturn(mergeCommand);
|
||||
when(mergeCommand.call()).thenThrow(new NotMergedException()); // here
|
||||
// is
|
||||
// our
|
||||
// exception
|
||||
// we
|
||||
// are
|
||||
// testing
|
||||
// here is our exception we are testing
|
||||
when(mergeCommand.call()).thenThrow(new NotMergedException());
|
||||
|
||||
// refresh()->hardReset
|
||||
ResetCommand resetCommand = mock(ResetCommand.class);
|
||||
@@ -820,7 +814,7 @@ public class JGitEnvironmentRepositoryTests {
|
||||
// refresh()->return
|
||||
// git.getRepository().findRef("HEAD").getObjectId().getName();
|
||||
Ref headRef = mock(Ref.class);
|
||||
when(this.database.getRef(anyString())).thenReturn(headRef);
|
||||
when(this.database.findRef(anyString())).thenReturn(headRef);
|
||||
|
||||
ObjectId newObjectId = ObjectId.fromRaw(new int[] { 1, 2, 3, 4, 5 });
|
||||
when(headRef.getObjectId()).thenReturn(newObjectId);
|
||||
@@ -1135,13 +1129,8 @@ public class JGitEnvironmentRepositoryTests {
|
||||
when(git.branchDelete()).thenReturn(deleteBranchCommand);
|
||||
when(deleteBranchCommand.setBranchNames(eq("feature/deletedBranchFromOrigin"))).thenReturn(deleteBranchCommand);
|
||||
when(deleteBranchCommand.setForce(true)).thenReturn(deleteBranchCommand);
|
||||
when(deleteBranchCommand.call()).thenThrow(new NotMergedException()); // here
|
||||
// is
|
||||
// our
|
||||
// exception
|
||||
// we
|
||||
// are
|
||||
// testing
|
||||
// here is our exception we are testing
|
||||
when(deleteBranchCommand.call()).thenThrow(new NotMergedException());
|
||||
|
||||
// refresh()->checkout
|
||||
CheckoutCommand checkoutCommand = mock(CheckoutCommand.class);
|
||||
@@ -1167,7 +1156,7 @@ public class JGitEnvironmentRepositoryTests {
|
||||
// refresh()->return
|
||||
// git.getRepository().findRef("HEAD").getObjectId().getName();
|
||||
Ref headRef = mock(Ref.class);
|
||||
when(this.database.getRef(anyString())).thenReturn(headRef);
|
||||
when(this.database.findRef(anyString())).thenReturn(headRef);
|
||||
|
||||
ObjectId newObjectId = ObjectId.fromRaw(new int[] { 1, 2, 3, 4, 5 });
|
||||
when(headRef.getObjectId()).thenReturn(newObjectId);
|
||||
|
||||
Reference in New Issue
Block a user