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

Method status

submodule.go:69–102  ·  view source on GitHub ↗
(idx *index.Index)

Source from the content-addressed store, hash-verified

67}
68
69func (s *Submodule) status(idx *index.Index) (*SubmoduleStatus, error) {
70 status := &SubmoduleStatus{
71 Path: s.c.Path,
72 }
73
74 e, err := idx.Entry(s.c.Path)
75 if err != nil && err != index.ErrEntryNotFound {
76 return nil, err
77 }
78
79 if e != nil {
80 status.Expected = e.Hash
81 }
82
83 if !s.initialized {
84 return status, nil
85 }
86
87 r, err := s.Repository()
88 if err != nil {
89 return nil, err
90 }
91
92 head, err := r.Head()
93 if err == nil {
94 status.Current = head.Hash()
95 }
96
97 if err != nil && err == plumbing.ErrReferenceNotFound {
98 err = nil
99 }
100
101 return status, err
102}
103
104// Repository returns the Repository represented by this submodule
105func (s *Submodule) Repository() (*Repository, error) {

Callers 2

StatusMethod · 0.95
StatusMethod · 0.45

Calls 4

RepositoryMethod · 0.95
EntryMethod · 0.80
HeadMethod · 0.80
HashMethod · 0.65

Tested by

no test coverage detected