From e0abb0ca70f3b1a0c44fc4caa92720f2e202bb9c Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Tue, 23 Jul 2024 18:31:47 +0200 Subject: [PATCH] Fetch benchmark before checkout --- benchmark/benchmark.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/benchmark/benchmark.go b/benchmark/benchmark.go index de2292c..cfb73df 100644 --- a/benchmark/benchmark.go +++ b/benchmark/benchmark.go @@ -47,8 +47,11 @@ func main() { if err != nil { log.Fatal(err) } - - log.Printf("Done; Checking out benchmark branch") + + log.Printf("Benchmarking done; Fetching benchmark branch") + fetchBenchmark() + time.Sleep(200 * time.Millisecond) + log.Printf("Checking out benchmark branch") checkoutBenchmark() time.Sleep(200 * time.Millisecond) log.Printf("Adding benchmark results") @@ -72,8 +75,17 @@ func getHeadHash() string { return strings.TrimSpace(string(out)) } +func fetchBenchmark() { + gitFetch := exec.Command("git", "fetch", "origin", "benchmark") + gitFetch.Dir = "../" + out, err := gitFetch.CombinedOutput() + if err != nil { + log.Fatalf("Could not fetch benchmark branch with code %v and error %v", err, string(out)) + } +} + func checkoutBenchmark() { - gitCheckout := exec.Command("git", "checkout", "benchmark") + gitCheckout := exec.Command("git", "checkout", "origin/benchmark") gitCheckout.Dir = "../" out, err := gitCheckout.CombinedOutput() if err != nil {