Skip to content

Commit

Permalink
Do pull before get log.
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagolvlsantos committed May 4, 2024
1 parent 39a876f commit 861e814
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,16 @@ protected PullResult pull(String group, Git git) throws GitAPIException {
if (this.pulledRead.containsKey(git)) {
return null;
}
PullResult pull = git.pull().setCredentialsProvider(credentials(group)).call();
PullResult pull = doPull(group, git);
this.pulledRead.put(git, directoryRead(group));
log.debug("pullRead({}) time={}", group, System.currentTimeMillis() - time);
return pull;
}

protected PullResult doPull(String group, Git git) throws GitAPIException {
return git.pull().setCredentialsProvider(credentials(group)).call();
}

@Override
public PullResult pullWrite(String group) throws GitAPIException {
return pullWrite(group, gitWrite(group));
Expand Down Expand Up @@ -455,6 +459,7 @@ public Iterable<RevCommit> logWrite(String group, String path, Integer skip, Int
private Iterable<RevCommit> log(String group, String path, Git git, Integer skip, Integer max)
throws GitAPIException {
long time = System.currentTimeMillis();
doPull(group, git);
LogCommand command = git.log();
String normalizedPath = normalizeRead(group, path);
if (normalizedPath != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ void testWriteReadAt(@Autowired ApplicationContext ctx) throws Exception {
BasicRead r = ctx.getBean(BasicRead.class);

String tool = System.getenv("TOOL");
if (tool == null) {
tool = System.getProperty("TOOL", "local");
}
System.out.println("@@@@@@@ TOOL = " + tool);
// # FIRST WRITE

Expand Down

0 comments on commit 861e814

Please sign in to comment.