@@ -146,15 +146,31 @@ private void sampleRepoNotifyCommit(GitSampleRepoRule sampleRepo) throws Excepti
146
146
}
147
147
148
148
private void sampleRepo1ContentMaster () throws Exception {
149
- sampleRepo1ContentMaster (null );
149
+ sampleRepo1ContentMaster (null , null );
150
150
}
151
151
152
152
private void sampleRepo1ContentMaster (String subdir ) throws Exception {
153
+ sampleRepo1ContentMaster (subdir , null );
154
+ }
155
+
156
+ private void sampleRepo1ContentMaster (String subdir , String addCustom ) throws Exception {
153
157
if (subdir != null && !(subdir .endsWith ("/" ))) subdir += "/" ;
154
158
if (subdir == null ) subdir = "" ;
155
159
sampleRepo .init ();
156
160
sampleRepo .write (subdir + "vars/myecho.groovy" , "def call() {echo 'something special'}" );
157
- sampleRepo .git ("add" , subdir + "vars" );
161
+ if (addCustom == null ) {
162
+ sampleRepo .git ("add" , subdir + "vars" );
163
+ } else {
164
+ if (addCustom == "" ) {
165
+ if (subdir == "" ) {
166
+ sampleRepo .git ("add" , "." );
167
+ } else {
168
+ sampleRepo .git ("add" , subdir );
169
+ }
170
+ } else {
171
+ sampleRepo .git ("add" , addCustom );
172
+ }
173
+ }
158
174
sampleRepo .git ("commit" , "--message=init" );
159
175
}
160
176
@@ -1563,10 +1579,7 @@ public static class BasicSCMSource extends SCMSource {
1563
1579
}
1564
1580
1565
1581
@ Test public void cloneModeLibraryPath () throws Exception {
1566
- sampleRepo .init ();
1567
- sampleRepo .write ("sub/path/vars/myecho.groovy" , "def call() {echo 'something special'}" );
1568
- sampleRepo .git ("add" , "sub" );
1569
- sampleRepo .git ("commit" , "--message=init" );
1582
+ sampleRepo1ContentMaster ("sub/path" , "sub" );
1570
1583
SCMSourceRetriever scm = new SCMSourceRetriever (new GitSCMSource (sampleRepo .toString ()));
1571
1584
LibraryConfiguration lc = new LibraryConfiguration ("root_sub_path" , scm );
1572
1585
lc .setIncludeInChangesets (false );
@@ -1584,10 +1597,7 @@ public static class BasicSCMSource extends SCMSource {
1584
1597
}
1585
1598
1586
1599
@ Test public void cloneModeLibraryPathSecurity () throws Exception {
1587
- sampleRepo .init ();
1588
- sampleRepo .write ("sub/path/vars/myecho.groovy" , "def call() {echo 'something special'}" );
1589
- sampleRepo .git ("add" , "sub" );
1590
- sampleRepo .git ("commit" , "--message=init" );
1600
+ sampleRepo1ContentMaster ("sub/path" , "sub" );
1591
1601
SCMSourceRetriever scm = new SCMSourceRetriever (new GitSCMSource (sampleRepo .toString ()));
1592
1602
LibraryConfiguration lc = new LibraryConfiguration ("root_sub_path" , scm );
1593
1603
lc .setIncludeInChangesets (false );
0 commit comments