MCPcopy Create free account
hub / github.com/go-git/go-git / testPlainOpenGitFile

Method testPlainOpenGitFile

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

Source from the content-addressed store, hash-verified

749}
750
751func (s *RepositorySuite) testPlainOpenGitFile(c *C, f func(string, string) string) {
752 fs, clean := s.TemporalFilesystem()
753 defer clean()
754
755 dir, err := util.TempDir(fs, "", "plain-open")
756 c.Assert(err, IsNil)
757
758 r, err := PlainInit(fs.Join(fs.Root(), dir), true)
759 c.Assert(err, IsNil)
760 c.Assert(r, NotNil)
761
762 altDir, err := util.TempDir(fs, "", "plain-open")
763 c.Assert(err, IsNil)
764
765 err = util.WriteFile(fs, fs.Join(altDir, ".git"),
766 []byte(f(fs.Join(fs.Root(), dir), fs.Join(fs.Root(), altDir))),
767 0644,
768 )
769
770 c.Assert(err, IsNil)
771
772 r, err = PlainOpen(fs.Join(fs.Root(), altDir))
773 c.Assert(err, IsNil)
774 c.Assert(r, NotNil)
775}
776
777func (s *RepositorySuite) TestPlainOpenBareAbsoluteGitDirFile(c *C) {
778 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