@@ -141,15 +141,31 @@ private void sampleRepoNotifyCommit(GitSampleRepoRule sampleRepo) throws Excepti
141
141
}
142
142
143
143
private void sampleRepo1ContentMaster () throws Exception {
144
- sampleRepo1ContentMaster (null );
144
+ sampleRepo1ContentMaster (null , null );
145
145
}
146
146
147
147
private void sampleRepo1ContentMaster (String subdir ) throws Exception {
148
+ sampleRepo1ContentMaster (subdir , null );
149
+ }
150
+
151
+ private void sampleRepo1ContentMaster (String subdir , String addCustom ) throws Exception {
148
152
if (subdir != null && !(subdir .endsWith ("/" ))) subdir += "/" ;
149
153
if (subdir == null ) subdir = "" ;
150
154
sampleRepo .init ();
151
155
sampleRepo .write (subdir + "vars/myecho.groovy" , "def call() {echo 'something special'}" );
152
- sampleRepo .git ("add" , subdir + "vars" );
156
+ if (addCustom == null ) {
157
+ sampleRepo .git ("add" , subdir + "vars" );
158
+ } else {
159
+ if (addCustom == "" ) {
160
+ if (subdir == "" ) {
161
+ sampleRepo .git ("add" , "." );
162
+ } else {
163
+ sampleRepo .git ("add" , subdir );
164
+ }
165
+ } else {
166
+ sampleRepo .git ("add" , addCustom );
167
+ }
168
+ }
153
169
sampleRepo .git ("commit" , "--message=init" );
154
170
}
155
171
@@ -1558,10 +1574,7 @@ public static class BasicSCMSource extends SCMSource {
1558
1574
}
1559
1575
1560
1576
@ Test public void cloneModeLibraryPath () throws Exception {
1561
- sampleRepo .init ();
1562
- sampleRepo .write ("sub/path/vars/myecho.groovy" , "def call() {echo 'something special'}" );
1563
- sampleRepo .git ("add" , "sub" );
1564
- sampleRepo .git ("commit" , "--message=init" );
1577
+ sampleRepo1ContentMaster ("sub/path" , "sub" );
1565
1578
SCMSourceRetriever scm = new SCMSourceRetriever (new GitSCMSource (sampleRepo .toString ()));
1566
1579
LibraryConfiguration lc = new LibraryConfiguration ("root_sub_path" , scm );
1567
1580
lc .setIncludeInChangesets (false );
@@ -1579,10 +1592,7 @@ public static class BasicSCMSource extends SCMSource {
1579
1592
}
1580
1593
1581
1594
@ Test public void cloneModeLibraryPathSecurity () throws Exception {
1582
- sampleRepo .init ();
1583
- sampleRepo .write ("sub/path/vars/myecho.groovy" , "def call() {echo 'something special'}" );
1584
- sampleRepo .git ("add" , "sub" );
1585
- sampleRepo .git ("commit" , "--message=init" );
1595
+ sampleRepo1ContentMaster ("sub/path" , "sub" );
1586
1596
SCMSourceRetriever scm = new SCMSourceRetriever (new GitSCMSource (sampleRepo .toString ()));
1587
1597
LibraryConfiguration lc = new LibraryConfiguration ("root_sub_path" , scm );
1588
1598
lc .setIncludeInChangesets (false );
0 commit comments