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

Function writeLooseObject

tests/objectverify/main_test.go:321–330  ·  view source on GitHub ↗
(t *testing.T, repo, objType string, content []byte)

Source from the content-addressed store, hash-verified

319}
320
321func writeLooseObject(t *testing.T, repo, objType string, content []byte) plumbing.Hash {
322 t.Helper()
323 cmd := exec.Command("git", "-C", repo, "hash-object", "-w", "--literally", "-t", objType, "--stdin")
324 cmd.Stdin = bytes.NewReader(content)
325 var stderr bytes.Buffer
326 cmd.Stderr = &stderr
327 out, err := cmd.Output()
328 require.NoErrorf(t, err, "git hash-object: %s", stderr.String())
329 return plumbing.NewHash(strings.TrimSpace(string(out)))
330}
331
332func gitVerifyCommit(t *testing.T, repo string, h plumbing.Hash) error {
333 t.Helper()

Callers 2

TestTagVerifyAlignmentFunction · 0.85

Calls 3

NewHashFunction · 0.92
CommandMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…