Skip to content

Commit

Permalink
Use shallow clone in credentials test to save some bandwidth
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEWaite committed Sep 21, 2015
1 parent b3c6898 commit ad3e18d
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -285,7 +285,14 @@ public void testFetchWithCredentials() throws URISyntaxException, GitException,
git.init_().workspace(repo.getAbsolutePath()).execute();
assertFalse("file " + fileToCheck + " in " + repo + ", has " + listDir(repo), clonedFile.exists());
addCredential(username, password, privateKey);
git.fetch_().from(new URIish(gitRepoURL), refSpecs).execute();
/* Save some bandwidth with shallow clone for CliGit, not yet available for JGit */
FetchCommand cmd = git.fetch_().from(new URIish(gitRepoURL), refSpecs);
if (gitImpl.equals("git")) {
// Reduce network transfer by using shallow clone
// JGit does not support shallow clone
cmd.shallow(true);
}
cmd.execute();
git.setRemoteUrl(origin, gitRepoURL);
ObjectId master = git.getHeadRev(gitRepoURL, "master");
log().println("Checking out " + master + " from " + gitRepoURL);
Expand Down

0 comments on commit ad3e18d

Please sign in to comment.