MCPcopy
hub / github.com/go-git/go-git / TestPlainCloneBareAndShared

Method TestPlainCloneBareAndShared

repository_test.go:913–938  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

911}
912
913func (s *RepositorySuite) TestPlainCloneBareAndShared(c *C) {
914 dir := c.MkDir()
915
916 remote := s.GetBasicLocalRepositoryURL()
917
918 r, err := PlainClone(dir, true, &CloneOptions{
919 URL: remote,
920 Shared: true,
921 })
922 c.Assert(err, IsNil)
923
924 altpath := path.Join(dir, "objects", "info", "alternates")
925 _, err = os.Stat(altpath)
926 c.Assert(err, IsNil)
927
928 data, err := os.ReadFile(altpath)
929 c.Assert(err, IsNil)
930
931 line := path.Join(remote, GitDirName, "objects") + "\n"
932 c.Assert(string(data), Equals, line)
933
934 cfg, err := r.Config()
935 c.Assert(err, IsNil)
936 c.Assert(cfg.Branches, HasLen, 1)
937 c.Assert(cfg.Branches["master"].Name, Equals, "master")
938}
939
940func (s *RepositorySuite) TestPlainCloneShared(c *C) {
941 dir := c.MkDir()

Callers

nothing calls this directly

Calls 5

PlainCloneFunction · 0.85
JoinMethod · 0.80
StatMethod · 0.65
ConfigMethod · 0.65

Tested by

no test coverage detected