MCPcopy Create free account
hub / github.com/go-git/go-git / TestStatusIgnored

Method TestStatusIgnored

worktree_test.go:1302–1347  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

1300}
1301
1302func (s *WorktreeSuite) TestStatusIgnored(c *C) {
1303 fs := memfs.New()
1304 w := &Worktree{
1305 r: s.Repository,
1306 Filesystem: fs,
1307 }
1308
1309 w.Checkout(&CheckoutOptions{})
1310
1311 fs.MkdirAll("another", os.ModePerm)
1312 f, _ := fs.Create("another/file")
1313 f.Close()
1314 fs.MkdirAll("vendor/github.com", os.ModePerm)
1315 f, _ = fs.Create("vendor/github.com/file")
1316 f.Close()
1317 fs.MkdirAll("vendor/gopkg.in", os.ModePerm)
1318 f, _ = fs.Create("vendor/gopkg.in/file")
1319 f.Close()
1320
1321 status, _ := w.Status()
1322 c.Assert(len(status), Equals, 3)
1323 _, ok := status["another/file"]
1324 c.Assert(ok, Equals, true)
1325 _, ok = status["vendor/github.com/file"]
1326 c.Assert(ok, Equals, true)
1327 _, ok = status["vendor/gopkg.in/file"]
1328 c.Assert(ok, Equals, true)
1329
1330 f, _ = fs.Create(".gitignore")
1331 f.Write([]byte("vendor/g*/"))
1332 f.Close()
1333 f, _ = fs.Create("vendor/.gitignore")
1334 f.Write([]byte("!github.com/\n"))
1335 f.Close()
1336
1337 status, _ = w.Status()
1338 c.Assert(len(status), Equals, 4)
1339 _, ok = status[".gitignore"]
1340 c.Assert(ok, Equals, true)
1341 _, ok = status["another/file"]
1342 c.Assert(ok, Equals, true)
1343 _, ok = status["vendor/.gitignore"]
1344 c.Assert(ok, Equals, true)
1345 _, ok = status["vendor/github.com/file"]
1346 c.Assert(ok, Equals, true)
1347}
1348
1349func (s *WorktreeSuite) TestStatusUntracked(c *C) {
1350 fs := memfs.New()

Callers

nothing calls this directly

Calls 6

CheckoutMethod · 0.95
StatusMethod · 0.95
MkdirAllMethod · 0.80
CreateMethod · 0.80
CloseMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected