File tree Expand file tree Collapse file tree
src/main/java/hudson/plugins/git Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments