Skip to content

Commit

Permalink
skip TestDo on CI if missing .git
Browse files Browse the repository at this point in the history
  • Loading branch information
keegancsmith committed Oct 10, 2022
1 parent d45e927 commit 5040bd7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/git-sg/main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"os"
"path/filepath"
"testing"
)
Expand All @@ -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 == "" {
Expand Down

0 comments on commit 5040bd7

Please sign in to comment.