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

Method TestLogAllMissingReferences

repository_test.go:1836–1886  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

1834}
1835
1836func (s *RepositorySuite) TestLogAllMissingReferences(c *C) {
1837 r, _ := Init(memory.NewStorage(), nil)
1838 err := r.clone(context.Background(), &CloneOptions{
1839 URL: s.GetBasicLocalRepositoryURL(),
1840 })
1841 c.Assert(err, IsNil)
1842 err = r.Storer.RemoveReference(plumbing.HEAD)
1843 c.Assert(err, IsNil)
1844
1845 rIter, err := r.Storer.IterReferences()
1846 c.Assert(err, IsNil)
1847
1848 refCount := 0
1849 err = rIter.ForEach(func(ref *plumbing.Reference) error {
1850 refCount++
1851 return nil
1852 })
1853 c.Assert(err, IsNil)
1854 c.Assert(refCount, Equals, 4)
1855
1856 err = r.Storer.SetReference(plumbing.NewHashReference(plumbing.ReferenceName("DUMMY"), plumbing.NewHash("DUMMY")))
1857 c.Assert(err, IsNil)
1858
1859 rIter, err = r.Storer.IterReferences()
1860 c.Assert(err, IsNil)
1861
1862 refCount = 0
1863 err = rIter.ForEach(func(ref *plumbing.Reference) error {
1864 refCount++
1865 return nil
1866 })
1867 c.Assert(err, IsNil)
1868 c.Assert(refCount, Equals, 5)
1869
1870 cIter, err := r.Log(&LogOptions{
1871 All: true,
1872 })
1873 c.Assert(cIter, NotNil)
1874 c.Assert(err, IsNil)
1875
1876 cCount := 0
1877 cIter.ForEach(func(c *object.Commit) error {
1878 cCount++
1879 return nil
1880 })
1881 c.Assert(cCount, Equals, 9)
1882
1883 _, err = cIter.Next()
1884 c.Assert(err, Equals, io.EOF)
1885 cIter.Close()
1886}
1887
1888func (s *RepositorySuite) TestLogAllOrderByTime(c *C) {
1889 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 14

NewStorageFunction · 0.92
NewHashReferenceFunction · 0.92
ReferenceNameTypeAlias · 0.92
NewHashFunction · 0.92
InitFunction · 0.85
cloneMethod · 0.80
LogMethod · 0.80
RemoveReferenceMethod · 0.65
IterReferencesMethod · 0.65
ForEachMethod · 0.65
SetReferenceMethod · 0.65

Tested by

no test coverage detected