@@ -39,6 +39,7 @@ public class ScmSyncConfigurationBusiness {
3939 private SCMManipulator scmManipulator ;
4040 private File checkoutScmDirectory = null ;
4141 private ScmSyncConfigurationStatusManager scmSyncConfigurationStatusManager = null ;
42+ private List <String > manualSynchronizationIncludes = new ArrayList <String >();
4243
4344 /**
4445 * Use of a size 1 thread pool frees us from worrying about accidental thread death and
@@ -187,8 +188,17 @@ private void processCommitsQueue() {
187188 String firstNonExistingParentScmPath = pathRelativeToJenkinsRoot .getFirstNonExistingParentScmPath ();
188189
189190 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+ });
192202 } catch (IOException e ) {
193203 throw new LoggableException ("Error while copying file hierarchy to SCM directory" , FileUtils .class , "copyDirectory" , e );
194204 }
@@ -212,7 +222,8 @@ private void processCommitsQueue() {
212222 }
213223 for (Path path : commit .getChangeset ().getPathsToDelete ()){
214224 List <File > deletedFiles = deleteHierarchy (commit .getScmContext (), path );
215- updatedFiles .addAll (deletedFiles );
225+ if (deletedFiles != null )
226+ updatedFiles .addAll (deletedFiles );
216227 }
217228
218229 if (updatedFiles .isEmpty ()){
@@ -245,6 +256,15 @@ private void processCommitsQueue() {
245256 }
246257 }
247258
259+ public List <String > getManualSynchronizationIncludes () {
260+ return manualSynchronizationIncludes ;
261+ }
262+
263+ public void setManualSynchronizationIncludes (
264+ List <String > manualSynchronizationIncludes ) {
265+ this .manualSynchronizationIncludes = manualSynchronizationIncludes ;
266+ }
267+
248268 private boolean writeScmContentOnlyIfItDiffers (Path pathRelativeToJenkinsRoot , byte [] content , File fileTranslatedInScm )
249269 throws LoggableException {
250270 boolean scmContentUpdated = false ;
0 commit comments