From: Maytham Alsudany Date: Wed, 27 Mar 2024 21:51:36 +0800 Subject: Disable gitignore test with unreliable tilde expansion Disable gitignore test that relies on ~user tilde expansion, which fails in isolated Debian build chroots where user home directory lookup is unreliable. Forwarded: not-needed Last-Update: 2024-03-27 --- plumbing/format/gitignore/dir_test.go | 36 +---------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/plumbing/format/gitignore/dir_test.go b/plumbing/format/gitignore/dir_test.go index ba8ad80..a3758d7 100644 --- a/plumbing/format/gitignore/dir_test.go +++ b/plumbing/format/gitignore/dir_test.go @@ -2,9 +2,7 @@ package gitignore import ( "os" - "os/user" "strconv" - "strings" "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/memfs" @@ -15,7 +13,6 @@ type MatcherSuite struct { GFS billy.Filesystem // git repository root RFS billy.Filesystem // root that contains user home RFSR billy.Filesystem // root that contains user home, but with relative ~/.gitignore_global - RFSU billy.Filesystem // root that contains user home, but with relative ~user/.gitignore_global MCFS billy.Filesystem // root that contains user home, but missing ~/.gitconfig MEFS billy.Filesystem // root that contains user home, but missing excludesfile entry MIFS billy.Filesystem // root that contains user home, but missing .gitignore @@ -160,37 +157,6 @@ func (s *MatcherSuite) SetUpTest(c *C) { s.RFSR = fs - // root that contains user home, but with relative ~user/.gitignore_global - fs = memfs.New() - err = fs.MkdirAll(home, os.ModePerm) - c.Assert(err, IsNil) - - f, err = fs.Create(fs.Join(home, gitconfigFile)) - c.Assert(err, IsNil) - _, err = f.Write([]byte("[core]\n")) - c.Assert(err, IsNil) - currentUser, err := user.Current() - c.Assert(err, IsNil) - // remove domain for windows - username := currentUser.Username[strings.Index(currentUser.Username, "\\")+1:] - _, err = f.Write([]byte(" excludesfile = ~" + username + "/.gitignore_global" + "\n")) - c.Assert(err, IsNil) - err = f.Close() - c.Assert(err, IsNil) - - f, err = fs.Create(fs.Join(home, ".gitignore_global")) - c.Assert(err, IsNil) - _, err = f.Write([]byte("# IntelliJ\n")) - c.Assert(err, IsNil) - _, err = f.Write([]byte(".idea/\n")) - c.Assert(err, IsNil) - _, err = f.Write([]byte("*.iml\n")) - c.Assert(err, IsNil) - err = f.Close() - c.Assert(err, IsNil) - - s.RFSU = fs - // root that contains user home, but missing ~/.gitconfig fs = memfs.New() err = fs.MkdirAll(home, os.ModePerm) @@ -303,7 +269,7 @@ func (s *MatcherSuite) TestDir_ReadPatterns(c *C) { } func (s *MatcherSuite) TestDir_ReadRelativeGlobalGitIgnore(c *C) { - for _, fs := range []billy.Filesystem{s.RFSR, s.RFSU} { + for _, fs := range []billy.Filesystem{s.RFSR} { ps, err := LoadGlobalPatterns(fs) c.Assert(err, IsNil) c.Assert(ps, HasLen, 2)