MCPcopy
hub / github.com/go-git/go-git / TestStatusIgnored

Method TestStatusIgnored

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

Source from the content-addressed store, hash-verified

1501}
1502
1503func (s *WorktreeSuite) TestStatusIgnored(c *C) {
1504 fs := memfs.New()
1505 w := &Worktree{
1506 r: s.Repository,
1507 Filesystem: fs,
1508 }
1509
1510 w.Checkout(&CheckoutOptions{})
1511
1512 fs.MkdirAll("another", os.ModePerm)
1513 f, _ := fs.Create("another/file")
1514 f.Close()
1515 fs.MkdirAll("vendor/github.com", os.ModePerm)
1516 f, _ = fs.Create("vendor/github.com/file")
1517 f.Close()
1518 fs.MkdirAll("vendor/gopkg.in", os.ModePerm)
1519 f, _ = fs.Create("vendor/gopkg.in/file")
1520 f.Close()
1521
1522 status, _ := w.Status()
1523 c.Assert(len(status), Equals, 3)
1524 _, ok := status["another/file"]
1525 c.Assert(ok, Equals, true)
1526 _, ok = status["vendor/github.com/file"]
1527 c.Assert(ok, Equals, true)
1528 _, ok = status["vendor/gopkg.in/file"]
1529 c.Assert(ok, Equals, true)
1530
1531 f, _ = fs.Create(".gitignore")
1532 f.Write([]byte("vendor/g*/"))
1533 f.Close()
1534 f, _ = fs.Create("vendor/.gitignore")
1535 f.Write([]byte("!github.com/\n"))
1536 f.Close()
1537
1538 status, _ = w.Status()
1539 c.Assert(len(status), Equals, 4)
1540 _, ok = status[".gitignore"]
1541 c.Assert(ok, Equals, true)
1542 _, ok = status["another/file"]
1543 c.Assert(ok, Equals, true)
1544 _, ok = status["vendor/.gitignore"]
1545 c.Assert(ok, Equals, true)
1546 _, ok = status["vendor/github.com/file"]
1547 c.Assert(ok, Equals, true)
1548}
1549
1550func (s *WorktreeSuite) TestStatusUntracked(c *C) {
1551 fs := memfs.New()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected