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

Method TestAddSkipStatusNonModifiedPath

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

Source from the content-addressed store, hash-verified

2005}
2006
2007func (s *WorktreeSuite) TestAddSkipStatusNonModifiedPath(c *C) {
2008 fs := memfs.New()
2009 w := &Worktree{
2010 r: s.Repository,
2011 Filesystem: fs,
2012 }
2013
2014 err := w.Checkout(&CheckoutOptions{Force: true})
2015 c.Assert(err, IsNil)
2016
2017 idx, err := w.r.Storer.Index()
2018 c.Assert(err, IsNil)
2019 c.Assert(idx.Entries, HasLen, 9)
2020
2021 err = w.AddWithOptions(&AddOptions{Path: "LICENSE", SkipStatus: true})
2022 c.Assert(err, IsNil)
2023
2024 idx, err = w.r.Storer.Index()
2025 c.Assert(err, IsNil)
2026 c.Assert(idx.Entries, HasLen, 9)
2027
2028 e, err := idx.Entry("LICENSE")
2029 c.Assert(err, IsNil)
2030 c.Assert(e.Mode, Equals, filemode.Regular)
2031
2032 status, err := w.Status()
2033 c.Assert(err, IsNil)
2034 c.Assert(status, HasLen, 0)
2035
2036 file := status.File("LICENSE")
2037 c.Assert(file.Staging, Equals, Untracked)
2038 c.Assert(file.Worktree, Equals, Untracked)
2039}
2040
2041func (s *WorktreeSuite) TestAddSkipStatusWithIgnoredPath(c *C) {
2042 fs := memfs.New()

Callers

nothing calls this directly

Calls 6

CheckoutMethod · 0.95
AddWithOptionsMethod · 0.95
StatusMethod · 0.95
EntryMethod · 0.80
IndexMethod · 0.65
FileMethod · 0.45

Tested by

no test coverage detected