func isGitDir() bool {
    rc, _, _ := utils.Run(runIsGitDir)
    return rc == 0
}
Returns true if the current directory is a Git repo.
package git
import (
    "regexp"
    "strconv"
    "strings"
    "github.com/jtyr/gbt/pkg/core/car"
    "github.com/jtyr/gbt/pkg/core/utils"
)
type Car struct {
    car.Car
}
type statusCount struct {
    added     int
    copied    int
    deleted   int
    ignored   int
    modified  int
    renamed   int
    staged    int
    unmerged  int
    untracked int
}
var runIsGitDir = []string{"git", "rev-parse", "--git-dir"}
var runGetBranch = []string{"git", "symbolic-ref", "HEAD"}
var runGetTag = []string{"git", "describe", "--tags", "--exact-match", "HEAD"}
var runGetCommit = []string{"git", "rev-parse", "--short", "HEAD"}
var runIsDirty = []string{"git", "status", "--porcelain"}
var runCompareRemote = []string{"git", "rev-list", "--count"}
var runStash = []string{"git", "stash", "list"}
var reTemplatingHead = regexp.MustCompile(`{{\s*Head\s*}}`)
var reTemplatingStatus = regexp.MustCompile(`{{\s*Status.*\s*}}`)
var reTemplatingAhead = regexp.MustCompile(`{{\s*Ahead.*\s*}}`)
var reTemplatingBehind = regexp.MustCompile(`{{\s*Behind.*\s*}}`)
var reTemplatingStash = regexp.MustCompile(`{{\s*Stash.*\s*}}`)
var defaultRootFormat = utils.GetEnv("GBT_CAR_GIT_FORMAT", " {{ Icon }} {{ Head }} {{ Status }}{{ Ahead }}{{ Behind }} ")