MCPcopy
hub / github.com/git-lfs/git-lfs / HashObject

Function HashObject

git/git.go:286–298  ·  view source on GitHub ↗
(r io.Reader)

Source from the content-addressed store, hash-verified

284}
285
286func HashObject(r io.Reader) (string, error) {
287 cmd, err := gitNoLFS("hash-object", "--stdin")
288 if err != nil {
289 return "", errors.New(tr.Tr.Get("failed to find `git hash-object`: %v", err))
290 }
291 cmd.Stdin = r
292 out, err := cmd.Output()
293 if err != nil {
294 return "", errors.New(tr.Tr.Get("error building Git blob OID: %s", err))
295 }
296
297 return string(bytes.TrimSpace(out)), nil
298}
299
300func Log(args ...string) (*subprocess.BufferedCmd, error) {
301 logArgs := append([]string{"log"}, args...)

Callers 1

pointerCommandFunction · 0.92

Calls 4

NewFunction · 0.92
gitNoLFSFunction · 0.85
GetMethod · 0.65
OutputMethod · 0.45

Tested by

no test coverage detected