1package export
2
3import (
4 "os"
5 "os/exec"
6)
7
8func min(a int64, b int64) int64 {
9 if a > b {
10 return b
11 } else {
12 return a
13 }
14}
15
16func GetDir() (string, error) {
17 cmd := exec.Command("git", "rev-parse", "--git-dir")
18 cmd.Stderr = os.Stderr
19
20 dir, err := cmd.Output()
21 if err != nil {
22 return "", err
23 }
24
25 // Strip terminating newline
26 dir = dir[:len(dir)-1]
27
28 return string(dir), nil
29}