MCPcopy Index your code
hub / github.com/go-git/go-git / TestRepositoryAbsoluteLocalURLPreserved

Method TestRepositoryAbsoluteLocalURLPreserved

submodule_test.go:371–390  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

369}
370
371func (s *SubmoduleSuite) TestRepositoryAbsoluteLocalURLPreserved(c *C) {
372 raw := "/abs/path/X.git"
373 sm := newSubmoduleForRelativeURL(c, "", "basic", raw)
374
375 r, err := sm.Repository()
376 c.Assert(err, IsNil)
377
378 remotes, err := r.Remotes()
379 c.Assert(err, IsNil)
380 c.Assert(remotes, HasLen, 1)
381
382 // transport.NewEndpoint -> parseFile normalizes via filepath.Abs;
383 // on Windows this prepends a drive letter. Mirror that here so the
384 // assertion is portable. The point of this test is that the
385 // relative-resolution branch is skipped for absolute inputs, not
386 // the exact form parseFile produces.
387 expected, err := filepath.Abs(raw)
388 c.Assert(err, IsNil)
389 c.Assert(remotes[0].Config().URLs[0], Equals, "file://"+expected)
390}
391
392func (s *SubmoduleSuite) TestRepositoryRelativeURLNoParentRemote(c *C) {
393 sm := newSubmoduleForRelativeURL(c, "", "basic", "../X.git")

Callers

nothing calls this directly

Calls 4

RepositoryMethod · 0.80
RemotesMethod · 0.80
ConfigMethod · 0.65

Tested by

no test coverage detected