Skip to content

Commit 6aafa5b

Browse files
author
Andrew Bayer
committed
[HUDSON-7276] For some reason, git clean wasn't being run for builds with merges. No idea why.
1 parent be756d0 commit 6aafa5b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,11 @@ public Object[] invoke(File localWorkspace, VirtualChannel channel)
819819

820820

821821
buildData.saveBuild(new Build(revToBuild, buildNumber, Result.FAILURE));
822-
822+
if (getClean()) {
823+
listener.getLogger().println("Cleaning workspace");
824+
git.clean();
825+
}
826+
823827
return new Object[]{null, buildData};
824828
}
825829

@@ -852,6 +856,10 @@ public Object[] invoke(File localWorkspace, VirtualChannel channel)
852856
buildData.saveBuild(build);
853857
GitUtils gu = new GitUtils(listener,git);
854858
build.mergeRevision = gu.getRevisionForSHA1(target);
859+
if (getClean()) {
860+
listener.getLogger().println("Cleaning workspace");
861+
git.clean();
862+
}
855863

856864
// Fetch the diffs into the changelog file
857865
return new Object[]{changeLog.toString(), buildData};

0 commit comments

Comments
 (0)