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)
| 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. |
| 609 | func 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). |
no test coverage detected