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

Method testPlainOpenGitFile

repository_test.go:745–768  ·  view source on GitHub ↗
(c *C, f func(string, string) string)

Source from the content-addressed store, hash-verified

743}
744
745func (s *RepositorySuite) testPlainOpenGitFile(c *C, f func(string, string) string) {
746 fs := s.TemporalFilesystem(c)
747
748 dir, err := util.TempDir(fs, "", "plain-open")
749 c.Assert(err, IsNil)
750
751 r, err := PlainInit(fs.Join(fs.Root(), dir), true)
752 c.Assert(err, IsNil)
753 c.Assert(r, NotNil)
754
755 altDir, err := util.TempDir(fs, "", "plain-open")
756 c.Assert(err, IsNil)
757
758 err = util.WriteFile(fs, fs.Join(altDir, ".git"),
759 []byte(f(fs.Join(fs.Root(), dir), fs.Join(fs.Root(), altDir))),
760 0644,
761 )
762
763 c.Assert(err, IsNil)
764
765 r, err = PlainOpen(fs.Join(fs.Root(), altDir))
766 c.Assert(err, IsNil)
767 c.Assert(r, NotNil)
768}
769
770func (s *RepositorySuite) TestPlainOpenBareAbsoluteGitDirFile(c *C) {
771 s.testPlainOpenGitFile(c, func(dir, altDir string) string {

Calls 5

PlainInitFunction · 0.85
PlainOpenFunction · 0.85
JoinMethod · 0.80
RootMethod · 0.80
TemporalFilesystemMethod · 0.45

Tested by

no test coverage detected