MCPcopy Create free account
hub / github.com/github/gh-aw / readLocalExperimentState

Function readLocalExperimentState

pkg/cli/experiments_command.go:609–616  ·  view source on GitHub ↗

readLocalExperimentState reads state.json from a local git ref (e.g. "origin/experiments/foo"). Returns an empty state when the file is absent or cannot be parsed.

(ref string)

Source from the content-addressed store, hash-verified

607// readLocalExperimentState reads state.json from a local git ref (e.g. "origin/experiments/foo").
608// Returns an empty state when the file is absent or cannot be parsed.
609func readLocalExperimentState(ref string) *ExperimentState {
610 cmd := exec.Command("git", "show", ref+":state.json")
611 out, err := cmd.Output()
612 if err != nil {
613 return emptyExperimentState()
614 }
615 return parseExperimentState(out)
616}
617
618// readRemoteExperimentState fetches state.json from an experiments/* branch via the GitHub API.
619// Returns an empty state on any error (branch missing, file absent, parse failure).

Callers 2

fetchLocalExperimentsFunction · 0.85

Calls 2

emptyExperimentStateFunction · 0.85
parseExperimentStateFunction · 0.85

Tested by

no test coverage detected