MCPcopy Create free account
hub / github.com/cloudflare/artifact-fs / sshBatchModeCommand

Function sshBatchModeCommand

internal/gitstore/gitstore.go:1071–1098  ·  view source on GitHub ↗
(existing string)

Source from the content-addressed store, hash-verified

1069 }
1070 remoteURL, err := runGit(ctx, repo.GitDir, "remote", "get-url", "origin")
1071 if err == nil && remoteHasInlineCredentials(remoteURL) {
1072 return errors.New("prepared git dir origin must use ambient credentials")
1073 }
1074 return nil
1075}
1076
1077func (s *Store) ResolveHEAD(ctx context.Context, repo model.RepoConfig) (oid string, ref string, err error) {
1078 oid, err = runGit(ctx, repo.GitDir, "rev-parse", "HEAD")
1079 if err != nil {
1080 return "", "", err
1081 }
1082 ref, err = runGit(ctx, repo.GitDir, "symbolic-ref", "-q", "--short", "HEAD")
1083 if err != nil {
1084 ref = "DETACHED"
1085 err = nil
1086 }
1087 return strings.TrimSpace(oid), strings.TrimSpace(ref), nil
1088}
1089
1090func (s *Store) BuildTreeIndex(ctx context.Context, repo model.RepoConfig, headOID string) ([]model.BaseNode, error) {
1091 // -z: NUL-delimited output with raw paths (no C-quoting of non-ASCII names).
1092 nodes := []model.BaseNode{rootNode(repo.ID)}
1093 var blobOIDs []string
1094 blobIndex := map[string][]int{} // oid -> indices into nodes
1095 var parseErr error
1096 if err := streamTreeRecords(ctx, repo.GitDir, headOID, func(line string) {
1097 n, typ, ok := parseTreeRecord(repo.ID, line)
1098 if !ok {
1099 if parseErr == nil {
1100 parseErr = fmt.Errorf("invalid ls-tree record %q", line)
1101 }

Callers 1

nonInteractiveGitEnvFunction · 0.85

Calls 4

splitShellFieldsFunction · 0.85
isBatchModeOptionFunction · 0.85
JoinMethod · 0.80
shellQuoteFunction · 0.70

Tested by

no test coverage detected