From 517d5bfabb869a017aa6b7eccb08362e1c2e0371 Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Fri, 23 Sep 2022 09:37:53 +0200 Subject: [PATCH] skip TestDo on CI if missing .git --- cmd/git-sg/main_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/git-sg/main_test.go b/cmd/git-sg/main_test.go index 4a0feea2..9289e7ef 100644 --- a/cmd/git-sg/main_test.go +++ b/cmd/git-sg/main_test.go @@ -1,6 +1,7 @@ package main import ( + "os" "path/filepath" "testing" ) @@ -12,6 +13,10 @@ func TestDo(t *testing.T) { } t.Setenv("GIT_DIR", dir) + if _, err := os.Stat(dir); os.Getenv("CI") != "" && os.IsNotExist(err) { + t.Skipf("skipping since on CI and this is not a git checkout: %v", err) + } + for _, envvar := range []string{"", "GIT_SG_BUFFER", "GIT_SG_FILTER", "GIT_SG_CATFILE", "GIT_SG_LSTREE"} { name := envvar if name == "" {