summaryrefslogtreecommitdiff
path: root/gitConfig.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-25 02:23:56 -0600
committerJeff Carr <[email protected]>2024-01-25 02:23:56 -0600
commit86136ce6152d2125a53fa98adb6e6ed4db949190 (patch)
tree25131c5dc1c0fa7f10ee9a30c894d1d185db9e6f /gitConfig.go
parent4beeb0bb137bf179064354fa6fc3be2c951bdef6 (diff)
avoid a few nil'sv0.13.4
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gitConfig.go')
-rw-r--r--gitConfig.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/gitConfig.go b/gitConfig.go
index d15b291..d30918c 100644
--- a/gitConfig.go
+++ b/gitConfig.go
@@ -79,7 +79,13 @@ func (rs *RepoStatus) readGitConfig() error {
filename := filepath.Join(rs.realPath.String(), "/.git/config")
file, err := os.Open(filename)
if err != nil {
- return nil
+ filename = filepath.Join(rs.realPath.String(), "../.git/config")
+ log.Log(WARN, "readGitConfig() trying up one directory instead", filename)
+ file, err = os.Open(filename)
+ if err != nil {
+ panic("couldn't open .git/config")
+ return nil
+ }
}
defer file.Close()