File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,8 @@ func (l *fileLoader) errIfArgEqualOrHigher(
267
267
// path but a different tag?
268
268
func (l * fileLoader ) errIfRepoCycle (newRepoSpec * git.RepoSpec ) error {
269
269
// TODO(monopole): Use parsed data instead of Raw().
270
- if strings .HasPrefix (l .repoSpec .Raw (), newRepoSpec .Raw ()) {
270
+ if l .repoSpec != nil &&
271
+ strings .HasPrefix (l .repoSpec .Raw (), newRepoSpec .Raw ()) {
271
272
return fmt .Errorf (
272
273
"cycle detected: URI '%s' referenced by previous URI '%s'" ,
273
274
newRepoSpec .Raw (), l .repoSpec .Raw ())
Original file line number Diff line number Diff line change @@ -455,3 +455,29 @@ func TestLoaderDisallowsLocalBaseFromRemoteOverlay(t *testing.T) {
455
455
t .Fatalf ("unexpected err: %v" , err )
456
456
}
457
457
}
458
+
459
+ func TestLocalLoaderReferencingGitBase (t * testing.T ) {
460
+ topDir := "/whatever"
461
+ cloneRoot := topDir + "/someClone"
462
+ fSys := fs .MakeFakeFS ()
463
+ fSys .MkdirAll (topDir )
464
+ fSys .MkdirAll (cloneRoot + "/foo/base" )
465
+
466
+ root , err := demandDirectoryRoot (fSys , topDir )
467
+ if err != nil {
468
+ t .Fatalf ("unexpected err: %v\n " , err )
469
+ }
470
+ l1 := newLoaderAtConfirmedDir (
471
+ root , fSys , nil ,
472
+ git .DoNothingCloner (fs .ConfirmedDir (cloneRoot )))
473
+ if l1 .Root () != topDir {
474
+ t .Fatalf ("unexpected root %s" , l1 .Root ())
475
+ }
476
+ l2 , err := l1 .New ("github.com/someOrg/someRepo/foo/base" )
477
+ if err != nil {
478
+ t .Fatalf ("unexpected err: %v\n " , err )
479
+ }
480
+ if l2 .Root () != cloneRoot + "/foo/base" {
481
+ t .Fatalf ("unexpected root %s" , l2 .Root ())
482
+ }
483
+ }
You can’t perform that action at this time.
0 commit comments