Skip to content

Commit

Permalink
[JENKINS-14575] Wrap GitException into IOException
Browse files Browse the repository at this point in the history
The retry logic does not catch the GitException, so we have to wrap into a IOException. Clone and Fetch also affected. As of now the scmRetry will work with the git plugin.
  • Loading branch information
Adam PAPAI committed Mar 28, 2013
1 parent 3ab1db8 commit d82a9f3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/hudson/plugins/git/GitSCM.java
Expand Up @@ -1010,17 +1010,23 @@ 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;
for (RemoteConfig remoteRepository : repos) {
fetched |= fetchFrom(git, listener, remoteRepository);
try {
fetched |= fetchFrom(git, listener, remoteRepository);
} catch (GitException ex) {
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");
}

if (clean) {
Expand Down

0 comments on commit d82a9f3

Please sign in to comment.