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

Method status

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

Source from the content-addressed store, hash-verified

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