newSubmoduleForRelativeURL constructs an in-memory Repository with the given parent remote URL configured as origin, plus a Submodule whose configured URL is the given submoduleURL. Returns the submodule for direct Repository() invocation. Pass parentRemoteURL = "" to omit the origin remote entirely
(c *C, parentRemoteURL, submoduleName, submoduleURL string)
| 300 | // submodule for direct Repository() invocation. Pass parentRemoteURL |
| 301 | // = "" to omit the origin remote entirely. |
| 302 | func newSubmoduleForRelativeURL(c *C, parentRemoteURL, submoduleName, submoduleURL string) *Submodule { |
| 303 | repo := &Repository{ |
| 304 | Storer: memory.NewStorage(), |
| 305 | wt: memfs.New(), |
| 306 | } |
| 307 | if parentRemoteURL != "" { |
| 308 | _, err := repo.CreateRemote(&config.RemoteConfig{ |
| 309 | Name: DefaultRemoteName, |
| 310 | URLs: []string{parentRemoteURL}, |
| 311 | }) |
| 312 | c.Assert(err, IsNil) |
| 313 | } |
| 314 | worktree := &Worktree{ |
| 315 | Filesystem: memfs.New(), |
| 316 | r: repo, |
| 317 | } |
| 318 | return &Submodule{ |
| 319 | initialized: true, |
| 320 | c: &config.Submodule{ |
| 321 | Name: submoduleName, |
| 322 | Path: submoduleName, |
| 323 | URL: submoduleURL, |
| 324 | }, |
| 325 | w: worktree, |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | func (s *SubmoduleSuite) TestRepositoryRelativeURLHTTPSParent(c *C) { |
| 330 | sm := newSubmoduleForRelativeURL(c, |
no test coverage detected
searching dependent graphs…