Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

*: windows support, some more fixes (2) #536

Merged
merged 5 commits into from
Aug 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions plumbing/format/index/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var _ = Suite(&IndexSuite{})
func (s *IndexSuite) TestDecode(c *C) {
f, err := fixtures.Basic().One().DotGit().Open("index")
c.Assert(err, IsNil)
defer func() { c.Assert(f.Close(), IsNil) }()

idx := &Index{}
d := NewDecoder(f)
Expand All @@ -34,6 +35,7 @@ func (s *IndexSuite) TestDecode(c *C) {
func (s *IndexSuite) TestDecodeEntries(c *C) {
f, err := fixtures.Basic().One().DotGit().Open("index")
c.Assert(err, IsNil)
defer func() { c.Assert(f.Close(), IsNil) }()

idx := &Index{}
d := NewDecoder(f)
Expand Down Expand Up @@ -64,6 +66,7 @@ func (s *IndexSuite) TestDecodeEntries(c *C) {
func (s *IndexSuite) TestDecodeCacheTree(c *C) {
f, err := fixtures.Basic().One().DotGit().Open("index")
c.Assert(err, IsNil)
defer func() { c.Assert(f.Close(), IsNil) }()

idx := &Index{}
d := NewDecoder(f)
Expand Down Expand Up @@ -93,6 +96,7 @@ var expectedEntries = []TreeEntry{
func (s *IndexSuite) TestDecodeMergeConflict(c *C) {
f, err := fixtures.Basic().ByTag("merge-conflict").One().DotGit().Open("index")
c.Assert(err, IsNil)
defer func() { c.Assert(f.Close(), IsNil) }()

idx := &Index{}
d := NewDecoder(f)
Expand Down Expand Up @@ -130,6 +134,7 @@ func (s *IndexSuite) TestDecodeMergeConflict(c *C) {
func (s *IndexSuite) TestDecodeExtendedV3(c *C) {
f, err := fixtures.Basic().ByTag("intent-to-add").One().DotGit().Open("index")
c.Assert(err, IsNil)
defer func() { c.Assert(f.Close(), IsNil) }()

idx := &Index{}
d := NewDecoder(f)
Expand All @@ -147,6 +152,7 @@ func (s *IndexSuite) TestDecodeExtendedV3(c *C) {
func (s *IndexSuite) TestDecodeResolveUndo(c *C) {
f, err := fixtures.Basic().ByTag("resolve-undo").One().DotGit().Open("index")
c.Assert(err, IsNil)
defer func() { c.Assert(f.Close(), IsNil) }()

idx := &Index{}
d := NewDecoder(f)
Expand All @@ -172,6 +178,7 @@ func (s *IndexSuite) TestDecodeResolveUndo(c *C) {
func (s *IndexSuite) TestDecodeV4(c *C) {
f, err := fixtures.Basic().ByTag("index-v4").One().DotGit().Open("index")
c.Assert(err, IsNil)
defer func() { c.Assert(f.Close(), IsNil) }()

idx := &Index{}
d := NewDecoder(f)
Expand Down
15 changes: 15 additions & 0 deletions plumbing/transport/file/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func (s *ServerSuite) SetUpSuite(c *C) {
}

func (s *ServerSuite) TestPush(c *C) {
if !s.checkExecPerm(c) {
c.Skip("go-git binary has not execution permissions")
}

// git <2.0 cannot push to an empty repository without a refspec.
cmd := exec.Command("git", "push",
"--receive-pack", s.ReceivePackBin,
Expand All @@ -48,6 +52,10 @@ func (s *ServerSuite) TestPush(c *C) {
}

func (s *ServerSuite) TestClone(c *C) {
if !s.checkExecPerm(c) {
c.Skip("go-git binary has not execution permissions")
}

pathToClone := c.MkDir()

cmd := exec.Command("git", "clone",
Expand All @@ -59,3 +67,10 @@ func (s *ServerSuite) TestClone(c *C) {
out, err := cmd.CombinedOutput()
c.Assert(err, IsNil, Commentf("combined stdout and stderr:\n%s\n", out))
}

func (s *ServerSuite) checkExecPerm(c *C) bool {
const userExecPermMask = 0100
info, err := os.Stat(s.ReceivePackBin)
c.Assert(err, IsNil)
return (info.Mode().Perm() & userExecPermMask) == userExecPermMask
}
2 changes: 1 addition & 1 deletion plumbing/transport/ssh/auth_method_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (s *SuiteCommon) TestNewSSHAgentAuthNoAgent(c *C) {

k, err := NewSSHAgentAuth("foo")
c.Assert(k, IsNil)
c.Assert(err, ErrorMatches, ".*SSH_AUTH_SOCK.*")
c.Assert(err, ErrorMatches, ".*SSH_AUTH_SOCK.*|.*SSH agent .* not running.*")
}

func (*SuiteCommon) TestNewPublicKeys(c *C) {
Expand Down
6 changes: 6 additions & 0 deletions plumbing/transport/test/upload_pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type UploadPackSuite struct {
func (s *UploadPackSuite) TestAdvertisedReferencesEmpty(c *C) {
r, err := s.Client.NewUploadPackSession(s.EmptyEndpoint, s.EmptyAuth)
c.Assert(err, IsNil)
defer func() { c.Assert(r.Close(), IsNil) }()

ar, err := r.AdvertisedReferences()
c.Assert(err, Equals, transport.ErrEmptyRemoteRepository)
c.Assert(ar, IsNil)
Expand All @@ -39,6 +41,8 @@ func (s *UploadPackSuite) TestAdvertisedReferencesEmpty(c *C) {
func (s *UploadPackSuite) TestAdvertisedReferencesNotExists(c *C) {
r, err := s.Client.NewUploadPackSession(s.NonExistentEndpoint, s.EmptyAuth)
c.Assert(err, IsNil)
defer func() { c.Assert(r.Close(), IsNil) }()

ar, err := r.AdvertisedReferences()
c.Assert(err, Equals, transport.ErrRepositoryNotFound)
c.Assert(ar, IsNil)
Expand All @@ -55,6 +59,8 @@ func (s *UploadPackSuite) TestAdvertisedReferencesNotExists(c *C) {
func (s *UploadPackSuite) TestCallAdvertisedReferenceTwice(c *C) {
r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth)
c.Assert(err, IsNil)
defer func() { c.Assert(r.Close(), IsNil) }()

ar1, err := r.AdvertisedReferences()
c.Assert(err, IsNil)
c.Assert(ar1, NotNil)
Expand Down
4 changes: 4 additions & 0 deletions worktree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ func (s *WorktreeSuite) TestCheckoutSymlink(c *C) {
}

func (s *WorktreeSuite) TestFilenameNormalization(c *C) {
if runtime.GOOS == "windows" {
c.Skip("windows paths may contain non utf-8 sequences")
}

url := c.MkDir()
path := fixtures.Basic().ByTag("worktree").One().Worktree().Root()

Expand Down