@@ -39,6 +39,7 @@ public class ScmSyncConfigurationBusiness {
39
39
private SCMManipulator scmManipulator ;
40
40
private File checkoutScmDirectory = null ;
41
41
private ScmSyncConfigurationStatusManager scmSyncConfigurationStatusManager = null ;
42
+ private List <String > manualSynchronizationIncludes = new ArrayList <String >();
42
43
43
44
/**
44
45
* Use of a size 1 thread pool frees us from worrying about accidental thread death and
@@ -187,8 +188,17 @@ private void processCommitsQueue() {
187
188
String firstNonExistingParentScmPath = pathRelativeToJenkinsRoot .getFirstNonExistingParentScmPath ();
188
189
189
190
try {
190
- FileUtils .copyDirectory (JenkinsFilesHelper .buildFileFromPathRelativeToHudsonRoot (pathRelativeToJenkinsRoot .getPath ()),
191
- fileTranslatedInScm );
191
+ File buildFileFromPathRelativeToHudsonRoot = JenkinsFilesHelper .buildFileFromPathRelativeToHudsonRoot (pathRelativeToJenkinsRoot .getPath ());
192
+ FileUtils .copyDirectory (buildFileFromPathRelativeToHudsonRoot , fileTranslatedInScm , new FileFilter () {
193
+ @ Override
194
+ public boolean accept (File pathname ) {
195
+ if (pathname .getPath ().endsWith (".xml" )
196
+ || getManualSynchronizationIncludes ().contains (pathname )){
197
+ return true ;
198
+ }
199
+ return false ;
200
+ }
201
+ });
192
202
} catch (IOException e ) {
193
203
throw new LoggableException ("Error while copying file hierarchy to SCM directory" , FileUtils .class , "copyDirectory" , e );
194
204
}
@@ -212,7 +222,8 @@ private void processCommitsQueue() {
212
222
}
213
223
for (Path path : commit .getChangeset ().getPathsToDelete ()){
214
224
List <File > deletedFiles = deleteHierarchy (commit .getScmContext (), path );
215
- updatedFiles .addAll (deletedFiles );
225
+ if (deletedFiles != null )
226
+ updatedFiles .addAll (deletedFiles );
216
227
}
217
228
218
229
if (updatedFiles .isEmpty ()){
@@ -245,6 +256,15 @@ private void processCommitsQueue() {
245
256
}
246
257
}
247
258
259
+ public List <String > getManualSynchronizationIncludes () {
260
+ return manualSynchronizationIncludes ;
261
+ }
262
+
263
+ public void setManualSynchronizationIncludes (
264
+ List <String > manualSynchronizationIncludes ) {
265
+ this .manualSynchronizationIncludes = manualSynchronizationIncludes ;
266
+ }
267
+
248
268
private boolean writeScmContentOnlyIfItDiffers (Path pathRelativeToJenkinsRoot , byte [] content , File fileTranslatedInScm )
249
269
throws LoggableException {
250
270
boolean scmContentUpdated = false ;
0 commit comments