diff options
author | Manuel Carmona <manu.carmona90@gmail.com> | 2017-08-03 09:41:22 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-08-03 09:41:22 +0200 |
commit | b29ccd9cf64cb3c6d7b3fdc6649d97416f3be734 (patch) | |
tree | 387355a75b7ffa6673a528c8c9bb543144450e97 | |
parent | 3713791015259f9e32cfe5fee76f9c99fc43fffd (diff) | |
download | go-git-b29ccd9cf64cb3c6d7b3fdc6649d97416f3be734.tar.gz |
*: windows support, some more fixes (#533)
* fixed windows failed test: "134 FAIL: repository_test.go:340: RepositorySuite.TestPlainOpenBareRelativeGitDirFileTrailingGarbage"
* fixed windows failed test: "143 FAIL: worktree_test.go:367: WorktreeSuite.TestCheckoutIndexOS"
* fixed windows failed test: "296 FAIL: receive_pack_test.go:36: ReceivePackSuite.TearDownTest"
* fixed windows failed test: "152 FAIL: worktree_test.go:278: WorktreeSuite.TestCheckoutSymlink"
-rw-r--r-- | plumbing/transport/file/receive_pack_test.go | 2 | ||||
-rw-r--r-- | plumbing/transport/test/receive_pack.go | 1 | ||||
-rw-r--r-- | repository.go | 2 | ||||
-rw-r--r-- | repository_test.go | 2 | ||||
-rw-r--r-- | worktree_test.go | 15 |
5 files changed, 15 insertions, 7 deletions
diff --git a/plumbing/transport/file/receive_pack_test.go b/plumbing/transport/file/receive_pack_test.go index ab21aea..a7dc399 100644 --- a/plumbing/transport/file/receive_pack_test.go +++ b/plumbing/transport/file/receive_pack_test.go @@ -70,6 +70,6 @@ func (s *ReceivePackSuite) TestNonExistentCommand(c *C) { cmd := "/non-existent-git" client := NewClient(cmd, cmd) session, err := client.NewReceivePackSession(s.Endpoint, s.EmptyAuth) - c.Assert(err, ErrorMatches, ".*no such file or directory.*") + c.Assert(err, ErrorMatches, ".*(no such file or directory.*|.*file does not exist)*.") c.Assert(session, IsNil) } diff --git a/plumbing/transport/test/receive_pack.go b/plumbing/transport/test/receive_pack.go index 6309ef0..d29d9ca 100644 --- a/plumbing/transport/test/receive_pack.go +++ b/plumbing/transport/test/receive_pack.go @@ -61,6 +61,7 @@ func (s *ReceivePackSuite) TestAdvertisedReferencesNotExists(c *C) { func (s *ReceivePackSuite) TestCallAdvertisedReferenceTwice(c *C) { r, err := s.Client.NewReceivePackSession(s.Endpoint, s.EmptyAuth) + defer func() { c.Assert(r.Close(), IsNil) }() c.Assert(err, IsNil) ar1, err := r.AdvertisedReferences() c.Assert(err, IsNil) diff --git a/repository.go b/repository.go index 72beefd..8110cf1 100644 --- a/repository.go +++ b/repository.go @@ -286,7 +286,7 @@ func dotGitFileToOSFilesystem(path string, fs billy.Filesystem) (billy.Filesyste return nil, fmt.Errorf(".git file has no %s prefix", prefix) } - gitdir := line[len(prefix):] + gitdir := strings.Split(line[len(prefix):], "\n")[0] gitdir = strings.TrimSpace(gitdir) if filepath.IsAbs(gitdir) { return osfs.New(gitdir), nil diff --git a/repository_test.go b/repository_test.go index 2fecc98..3da11f6 100644 --- a/repository_test.go +++ b/repository_test.go @@ -348,7 +348,7 @@ func (s *RepositorySuite) TestPlainOpenBareRelativeGitDirFileTrailingGarbage(c * altDir, err := ioutil.TempDir("", "plain-open") c.Assert(err, IsNil) - err = ioutil.WriteFile(filepath.Join(altDir, ".git"), []byte(fmt.Sprintf("gitdir: %s\nTRAILING", dir)), 0644) + err = ioutil.WriteFile(filepath.Join(altDir, ".git"), []byte(fmt.Sprintf("gitdir: %s\nTRAILING", altDir)), 0644) c.Assert(err, IsNil) r, err = PlainOpen(altDir) diff --git a/worktree_test.go b/worktree_test.go index 3ca26bc..0a1c2d1 100644 --- a/worktree_test.go +++ b/worktree_test.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "os" "path/filepath" + "runtime" "golang.org/x/text/unicode/norm" @@ -278,6 +279,10 @@ func (s *WorktreeSuite) TestCheckout(c *C) { } func (s *WorktreeSuite) TestCheckoutSymlink(c *C) { + if runtime.GOOS == "windows" { + c.Skip("git doesn't support symlinks by default in windows") + } + dir, err := ioutil.TempDir("", "checkout") defer os.RemoveAll(dir) @@ -430,10 +435,12 @@ func (s *WorktreeSuite) TestCheckoutIndexOS(c *C) { c.Assert(idx.Entries[0].Size, Equals, uint32(189)) c.Assert(idx.Entries[0].CreatedAt.IsZero(), Equals, false) - c.Assert(idx.Entries[0].Dev, Not(Equals), uint32(0)) - c.Assert(idx.Entries[0].Inode, Not(Equals), uint32(0)) - c.Assert(idx.Entries[0].UID, Not(Equals), uint32(0)) - c.Assert(idx.Entries[0].GID, Not(Equals), uint32(0)) + if runtime.GOOS != "windows" { + c.Assert(idx.Entries[0].Dev, Not(Equals), uint32(0)) + c.Assert(idx.Entries[0].Inode, Not(Equals), uint32(0)) + c.Assert(idx.Entries[0].UID, Not(Equals), uint32(0)) + c.Assert(idx.Entries[0].GID, Not(Equals), uint32(0)) + } } func (s *WorktreeSuite) TestCheckoutBranch(c *C) { |