MCPcopy Index your code
hub / github.com/docker/docker-agent / gitOut

Function gitOut

pkg/worktree/worktree_test.go:336–342  ·  view source on GitHub ↗
(t *testing.T, dir string, args ...string)

Source from the content-addressed store, hash-verified

334}
335
336func gitOut(t *testing.T, dir string, args ...string) string {
337 t.Helper()
338 cmd := exec.CommandContext(t.Context(), "git", append([]string{"-C", dir}, args...)...)
339 out, err := cmd.Output()
340 require.NoError(t, err)
341 return string(trimNL(out))
342}
343
344func trimNL(b []byte) []byte {
345 for len(b) > 0 && (b[len(b)-1] == '\n' || b[len(b)-1] == '\r') {

Calls 2

trimNLFunction · 0.85
ContextMethod · 0.80

Tested by

no test coverage detected