Skip to content

Commit

Permalink
Adding function to check if is a bare repository
Browse files Browse the repository at this point in the history
  • Loading branch information
gwendolyngoetz committed Nov 10, 2022
1 parent d642263 commit bd1bea0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
)

Expand All @@ -19,6 +20,18 @@ func IsRepo() bool {
return true
}

func IsBareRepository() bool {
out, _ := exec.Command(
"git",
"rev-parse",
"--is-bare-repository").
Output()

result := strings.TrimSpace(string(out))
resultB, _ := strconv.ParseBool(result)
return resultB
}

func GetRepoName() string {
out, _ := exec.Command(
"git",
Expand Down

0 comments on commit bd1bea0

Please sign in to comment.