Skip to content

Commit 884df96

Browse files
committed
checkout fix
1 parent be4b7a3 commit 884df96

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/main/java/org/scm4j/vcs/GitVCS.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,12 @@ private File getFileFromRepo(String branchName, String fileRelativePath) {
260260

261261
checkout(git, gitRepo, branchName);
262262

263-
return new File(wc.getFolder(), fileRelativePath);
264-
} catch (GitAPIException e) {
265-
throw new EVCSException(e);
266-
} catch (Exception e) {
267-
throw new RuntimeException(e);
268-
}
263+
return new File(wc.getFolder(), fileRelativePath);
264+
} catch (GitAPIException e) {
265+
throw new EVCSException(e);
266+
} catch (Exception e) {
267+
throw new RuntimeException(e);
268+
}
269269
}
270270

271271
@Override
@@ -328,6 +328,9 @@ void checkout(Git git, Repository gitRepo, String branchName) throws Exception {
328328
.call();
329329
git
330330
.checkout()
331+
.setStartPoint("origin/" + bn)
332+
.setCreateBranch(gitRepo.exactRef("refs/heads/" + bn) == null)
333+
.setUpstreamMode(SetupUpstreamMode.TRACK)
331334
.setName(bn)
332335
.call();
333336
}

0 commit comments

Comments
 (0)