From b053c58d180243fec3cf15b860119c15920194d2 Mon Sep 17 00:00:00 2001 From: Manuel Carmona Date: Fri, 28 Jul 2017 12:36:28 +0200 Subject: [PATCH 1/4] fixed windows failed test: "134 FAIL: repository_test.go:340: RepositorySuite.TestPlainOpenBareRelativeGitDirFileTrailingGarbage" --- repository.go | 2 +- repository_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/repository.go b/repository.go index 72beefd86..8110cf157 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 2fecc980e..3da11f692 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) From 5d6f3fa0a679f2ca86deaf649a982c28e03cb502 Mon Sep 17 00:00:00 2001 From: Manuel Carmona Date: Mon, 31 Jul 2017 11:22:47 +0200 Subject: [PATCH 2/4] fixed windows failed test: "143 FAIL: worktree_test.go:367: WorktreeSuite.TestCheckoutIndexOS" --- worktree_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/worktree_test.go b/worktree_test.go index 3ca26bc5e..d21fee877 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" @@ -430,10 +431,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) { From 8b41667e5fd70011d0b4981be63b0ec3dcebb10b Mon Sep 17 00:00:00 2001 From: Manuel Carmona Date: Tue, 1 Aug 2017 09:46:14 +0200 Subject: [PATCH 3/4] fixed windows failed test: "296 FAIL: receive_pack_test.go:36: ReceivePackSuite.TearDownTest" --- plumbing/transport/file/receive_pack_test.go | 2 +- plumbing/transport/test/receive_pack.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plumbing/transport/file/receive_pack_test.go b/plumbing/transport/file/receive_pack_test.go index ab21aea20..a7dc39963 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 6309ef0bb..d29d9ca29 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) From fadb6e98683a4dde33c32211e0819195fdae9b5a Mon Sep 17 00:00:00 2001 From: Manuel Carmona Date: Wed, 2 Aug 2017 12:04:59 +0200 Subject: [PATCH 4/4] fixed windows failed test: "152 FAIL: worktree_test.go:278: WorktreeSuite.TestCheckoutSymlink" --- worktree_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/worktree_test.go b/worktree_test.go index d21fee877..0a1c2d17d 100644 --- a/worktree_test.go +++ b/worktree_test.go @@ -279,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)