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

Commit

Permalink
*: windows support, some more fixes (#533)
Browse files Browse the repository at this point in the history
* 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"
  • Loading branch information
mcarmonaa authored and mcuadros committed Aug 3, 2017
1 parent 3713791 commit b29ccd9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plumbing/transport/file/receive_pack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
1 change: 1 addition & 0 deletions plumbing/transport/test/receive_pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 11 additions & 4 deletions worktree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"

"golang.org/x/text/unicode/norm"

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit b29ccd9

Please sign in to comment.