Unverified Commit fffe53ef authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Fix]fix git bug (#3429)

parent d30910ff
......@@ -151,6 +151,12 @@
<dependency>
<groupId>org.dromara.sms4j</groupId>
<artifactId>sms4j-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>cn.hutool</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
......
......@@ -32,6 +32,7 @@ import java.util.function.Consumer;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.LsRemoteCommand;
import org.eclipse.jgit.api.PullCommand;
import org.eclipse.jgit.api.TransportCommand;
import org.eclipse.jgit.api.TransportConfigCallback;
import org.eclipse.jgit.api.errors.GitAPIException;
......@@ -95,7 +96,6 @@ public class GitRepository {
FileUtil.mkdir(targetFile);
File writeFile = new File(targetFile, branch);
Git git;
try {
CloneCommand cloneCommand =
......@@ -109,30 +109,33 @@ public class GitRepository {
.readEnvironment()
.findGitDir()
.build();
git = new Git(repository);
git.pull()
.setProgressMonitor(new TextProgressMonitor(new StringWriter() {
@Override
public void write(String str) {
if (logFile != null) {
FileUtil.appendUtf8String(str, logFile);
}
if (consumer != null) {
consumer.accept(str);
}
System.out.println(str);
super.write(str);
try (Git git = new Git(repository)) {
PullCommand pullCommand = git.pull().setProgressMonitor(new TextProgressMonitor(new StringWriter() {
@Override
public void write(String str) {
if (logFile != null) {
FileUtil.appendUtf8String(str, logFile);
}
}))
.setCredentialsProvider(new UsernamePasswordCredentialsProvider(username, password))
.call();
git.close();
if (consumer != null) {
consumer.accept(str);
}
log.info(str);
super.write(str);
}
}));
if (!StrUtil.hasBlank(username, password)) {
pullCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider(username, password));
}
pullCommand.call();
}
} else {
cloneCommand.call().close();
}
return writeFile;
} catch (Exception e) {
e.printStackTrace();
log.error("", e);
throw new DinkyException(e);
}
}
......
......@@ -44,29 +44,29 @@ spring:
# 子配置项可以按需要打开或自定义配置
cache:
type: simple
# # 如果type配置为redis,则该项可按需配置
# redis:
## 是否缓存空值,保存默认即可
# cache-null-values: false
## 缓存过期时间,24小时
# time-to-live: 86400
# redis:
# host: 119.3.184.208
# port: 6379
# password: woai1998
# database: 10
# jedis:
# pool:
# # 连接池最大连接数(使用负值表示没有限制)
# max-active: 50
# # 连接池最大阻塞等待时间(使用负值表示没有限制)
# max-wait: 3000
# # 连接池中的最大空闲连接数
# max-idle: 20
# # 连接池中的最小空闲连接数
# min-idle: 5
# # 连接超时时间(毫秒)
# timeout: 5000
# # 如果type配置为redis,则该项可按需配置
# redis:
## 是否缓存空值,保存默认即可
# cache-null-values: false
## 缓存过期时间,24小时
# time-to-live: 86400
# redis:
# host: 119.3.184.208
# port: 6379
# password: woai1998
# database: 10
# jedis:
# pool:
# # 连接池最大连接数(使用负值表示没有限制)
# max-active: 50
# # 连接池最大阻塞等待时间(使用负值表示没有限制)
# max-wait: 3000
# # 连接池中的最大空闲连接数
# max-idle: 20
# # 连接池中的最小空闲连接数
# min-idle: 5
# # 连接超时时间(毫秒)
# timeout: 5000
# file upload config of servlet , the default is 500MB
servlet:
multipart:
......@@ -133,7 +133,7 @@ sa-token:
timeout: 36000
# The temporary validity period of the token (the token will be considered as expired if there is no operation within the specified time)
# unit: second , if you do not need to set a temporary token, you can set it to -1
active-timeout: 1800
active-timeout: -1
# Whether to allow the same account to log in concurrently (when true, allow login together, when false, new login squeezes out old login)
is-concurrent: false
# When multiple people log in to the same account, whether to share a token (if true, all logins share a token, and if false, create a new token for each login)
......
......@@ -68,7 +68,7 @@
<hamcrest.version>1.3</hamcrest.version>
<hibernate-validator.version>6.2.0.Final</hibernate-validator.version>
<httpclient.version>4.5.13</httpclient.version>
<hutool.version>5.8.25</hutool.version>
<hutool.version>5.8.27</hutool.version>
<jackson.version>2.14.1</jackson.version>
<jakarta.ws.rs-api.version>2.1.6</jakarta.ws.rs-api.version>
<jasypt.version>1.9.3</jasypt.version>
......@@ -77,7 +77,7 @@
<javax.mail>1.6.2</javax.mail>
<jaxb.version>2.3.0</jaxb.version>
<jedis.version>2.9.0</jedis.version>
<jgit.version>5.13.2.202306221912-r</jgit.version>
<jgit.version>5.13.3.202401111512-r</jgit.version>
<junit5.version>5.9.1</junit5.version>
<knife4j.version>4.1.0</knife4j.version>
<kubernetes-client.version>5.12.4</kubernetes-client.version>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment