MCPcopy Index your code
hub / github.com/go-git/go-git / updateHEAD

Method updateHEAD

worktree_commit.go:128–141  ·  view source on GitHub ↗
(commit plumbing.Hash)

Source from the content-addressed store, hash-verified

126}
127
128func (w *Worktree) updateHEAD(commit plumbing.Hash) error {
129 head, err := w.r.Storer.Reference(plumbing.HEAD)
130 if err != nil {
131 return err
132 }
133
134 name := plumbing.HEAD
135 if head.Type() != plumbing.HashReference {
136 name = head.Target()
137 }
138
139 ref := plumbing.NewHashReference(name, commit)
140 return w.r.Storer.SetReference(ref)
141}
142
143func (w *Worktree) buildCommitObject(msg string, opts *CommitOptions, tree plumbing.Hash) (plumbing.Hash, error) {
144 commit := &object.Commit{

Callers 2

CommitMethod · 0.95
PullContextMethod · 0.95

Calls 5

NewHashReferenceFunction · 0.92
TargetMethod · 0.80
ReferenceMethod · 0.65
TypeMethod · 0.65
SetReferenceMethod · 0.65

Tested by

no test coverage detected