Skip to content

Commit

Permalink
Shallow git clone for better performance
Browse files Browse the repository at this point in the history
Do not download the entire commit history from the remote.  Execute the
equivalent of `git clone --depth 1`

Fixes spring-cloud#1544
  • Loading branch information
pukkaone committed Apr 9, 2024
1 parent c372fcf commit 8a0ae52
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,8 @@ private Git copyFromLocalRepository() throws IOException {

private Git cloneToBasedir() throws GitAPIException {
CloneCommand clone = this.gitFactory.getCloneCommandByCloneRepository().setURI(getUri())
.setDirectory(getBasedir());
.setDirectory(getBasedir())
.setDepth(1);
configureCommand(clone);
try {
return clone.call();
Expand Down Expand Up @@ -772,7 +773,8 @@ public Git getGitByOpen(File file) throws IOException {
}

public CloneCommand getCloneCommandByCloneRepository() {
CloneCommand command = Git.cloneRepository().setCloneSubmodules(cloneSubmodules);
CloneCommand command = Git.cloneRepository().setCloneSubmodules(cloneSubmodules)
.setDepth(1);
return command;
}

Expand Down

0 comments on commit 8a0ae52

Please sign in to comment.