Skip to content

Commit dc415ec

Browse files
committed
[FIXED JENKINS-10348] Moved prune to after fetch.
1 parent 200c8d9 commit dc415ec

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/main/java/hudson/plugins/git/GitSCM.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -939,14 +939,6 @@ public Revision invoke(File localWorkspace, VirtualChannel channel)
939939
if (git.hasGitRepo()) {
940940
// It's an update
941941

942-
// Do we want to prune first?
943-
if (pruneBranches) {
944-
log.println("Pruning obsolete local branches");
945-
for (RemoteConfig remoteRepository : paramRepos) {
946-
git.prune(remoteRepository);
947-
}
948-
}
949-
950942
if (paramRepos.size() == 1)
951943
log.println("Fetching changes from 1 remote Git repository");
952944
else
@@ -966,6 +958,13 @@ public Revision invoke(File localWorkspace, VirtualChannel channel)
966958
listener.error("Could not fetch from any repository");
967959
throw new GitException("Could not fetch from any repository");
968960
}
961+
// Do we want to prune first?
962+
if (pruneBranches) {
963+
log.println("Pruning obsolete local branches");
964+
for (RemoteConfig remoteRepository : paramRepos) {
965+
git.prune(remoteRepository);
966+
}
967+
}
969968

970969
} else {
971970

0 commit comments

Comments
 (0)