From 921c31b9fc212910ce83cd06140c1d61f6514034 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Tue, 23 Jul 2024 18:39:52 +0200 Subject: [PATCH] Maybe delete local benchmark before pull.. --- benchmark/benchmark.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/benchmark/benchmark.go b/benchmark/benchmark.go index cfb73df..0c35f57 100644 --- a/benchmark/benchmark.go +++ b/benchmark/benchmark.go @@ -48,7 +48,11 @@ func main() { log.Fatal(err) } - log.Printf("Benchmarking done; Fetching benchmark branch") + log.Printf("Benchmarking done; writing results to git...") + log.Printf("Removing local benchmark branch") + removeLocalBenchmarkBranch() + time.Sleep(200 * time.Millisecond) + log.Printf("Fetching benchmark branch") fetchBenchmark() time.Sleep(200 * time.Millisecond) log.Printf("Checking out benchmark branch") @@ -65,6 +69,15 @@ func main() { log.Printf("Done") } +func removeLocalBenchmarkBranch() { + gitBranch := exec.Command("git", "branch", "-D", "benchmark") + gitBranch.Dir = "../" + out, err := gitBranch.CombinedOutput() + if err != nil { + log.Printf("Could not remove local benchmark branch with code %v and error %v", err, string(out)) + } +} + func getHeadHash() string { cmd := exec.Command("git", "rev-parse", "HEAD") cmd.Dir = "../"