Skip to content

Commit

Permalink
Merge pull request #143 from woohgit/master
Browse files Browse the repository at this point in the history
[JENKINS-14575] Fix to make the retry logic work with GitSCM
  • Loading branch information
ndeloof committed Apr 4, 2013
2 parents 086f185 + 3f135da commit f49bc41
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,3 +10,4 @@ work
nbactions.xml
release.properties
pom.xml.releaseBackup
.idea
15 changes: 11 additions & 4 deletions src/main/java/hudson/plugins/git/GitSCM.java
Expand Up @@ -973,12 +973,17 @@ public Collection<Revision> invoke(File localWorkspace, VirtualChannel channel)

boolean fetched = false;
for (RemoteConfig remoteRepository : repos) {
fetched |= fetchFrom(git, listener, remoteRepository);
try {
fetched |= fetchFrom(git, listener, remoteRepository);
} catch (GitException e) {
fetched |= false;
}
}

if (!fetched) {
listener.error("Could not fetch from any repository");
throw new GitException("Could not fetch from any repository");
// Throw IOException so the retry will be able to catch it
throw new IOException("Could not fetch from any repository");
}
// Do we want to prune first?
if (pruneBranches) {
Expand Down Expand Up @@ -1010,7 +1015,8 @@ public Collection<Revision> invoke(File localWorkspace, VirtualChannel channel)

if (!successfullyCloned) {
listener.error("Could not clone repository");
throw new GitException("Could not clone");
// Throw IOException so the retry will be able to catch it
throw new IOException("Could not clone");
}

boolean fetched = false;
Expand All @@ -1020,7 +1026,8 @@ public Collection<Revision> invoke(File localWorkspace, VirtualChannel channel)

if (!fetched) {
listener.error("Could not fetch from any repository");
throw new GitException("Could not fetch from any repository");
// Throw IOException so the retry will be able to catch it
throw new IOException("Could not fetch from any repository");
}

if (clean) {
Expand Down

0 comments on commit f49bc41

Please sign in to comment.