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

Method TestPlainOpenDetectDotGit

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

Source from the content-addressed store, hash-verified

850}
851
852func (s *RepositorySuite) TestPlainOpenDetectDotGit(c *C) {
853 fs := s.TemporalFilesystem(c)
854
855 dir, err := util.TempDir(fs, "", "")
856 c.Assert(err, IsNil)
857
858 subdir := filepath.Join(dir, "a", "b")
859 err = fs.MkdirAll(subdir, 0755)
860 c.Assert(err, IsNil)
861
862 file := fs.Join(subdir, "file.txt")
863 f, err := fs.Create(file)
864 c.Assert(err, IsNil)
865 f.Close()
866
867 r, err := PlainInit(fs.Join(fs.Root(), dir), false)
868 c.Assert(err, IsNil)
869 c.Assert(r, NotNil)
870
871 opt := &PlainOpenOptions{DetectDotGit: true}
872 r, err = PlainOpenWithOptions(fs.Join(fs.Root(), subdir), opt)
873 c.Assert(err, IsNil)
874 c.Assert(r, NotNil)
875
876 r, err = PlainOpenWithOptions(fs.Join(fs.Root(), file), opt)
877 c.Assert(err, IsNil)
878 c.Assert(r, NotNil)
879
880 optnodetect := &PlainOpenOptions{DetectDotGit: false}
881 r, err = PlainOpenWithOptions(fs.Join(fs.Root(), file), optnodetect)
882 c.Assert(err, NotNil)
883 c.Assert(r, IsNil)
884}
885
886func (s *RepositorySuite) TestPlainOpenNotExistsDetectDotGit(c *C) {
887 dir := c.MkDir()

Callers

nothing calls this directly

Calls 8

PlainInitFunction · 0.85
PlainOpenWithOptionsFunction · 0.85
JoinMethod · 0.80
RootMethod · 0.80
CloseMethod · 0.65
TemporalFilesystemMethod · 0.45
MkdirAllMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected