62
62
import static hudson .ExtensionList .lookupSingleton ;
63
63
import hudson .plugins .git .extensions .impl .CloneOption ;
64
64
import jenkins .plugins .git .traits .CloneOptionTrait ;
65
+ import jenkins .plugins .git .traits .RefSpecsSCMSourceTrait ;
65
66
import jenkins .scm .api .trait .SCMSourceTrait ;
66
67
import static org .hamcrest .Matchers .contains ;
67
68
import static org .hamcrest .Matchers .containsInAnyOrder ;
@@ -379,7 +380,9 @@ public static class BasicSCMSource extends SCMSource {
379
380
sampleRepo .git ("add" , "." );
380
381
sampleRepo .git ("commit" , "--message=init" );
381
382
GitSCMSource src = new GitSCMSource (sampleRepo .toString ());
382
- src .setTraits (List .<SCMSourceTrait >of (new CloneOptionTrait (new CloneOption (true , null , null ))));
383
+ CloneOption cloneOption = new CloneOption (true , true , null , null );
384
+ cloneOption .setHonorRefspec (true );
385
+ src .setTraits (List .<SCMSourceTrait >of (new CloneOptionTrait (cloneOption ), new RefSpecsSCMSourceTrait ("+refs/heads/master:refs/remotes/origin/master" )));
383
386
SCMSourceRetriever scm = new SCMSourceRetriever (src );
384
387
LibraryConfiguration lc = new LibraryConfiguration ("echoing" , scm );
385
388
lc .setIncludeInChangesets (false );
@@ -392,6 +395,8 @@ public static class BasicSCMSource extends SCMSource {
392
395
r .assertLogContains ("something special" , b );
393
396
r .assertLogContains ("Deleted .git, README.md" , b );
394
397
r .assertLogContains ("Using shallow clone with depth 1" , b );
398
+ r .assertLogContains ("Avoid fetching tags" , b );
399
+ r .assertLogNotContains ("+refs/heads/*:refs/remotes/origin/*" , b );
395
400
}
396
401
397
402
@ Test public void cloneModeLibraryPath () throws Exception {
0 commit comments