summaryrefslogtreecommitdiff
path: root/gitConfig.go
diff options
context:
space:
mode:
Diffstat (limited to 'gitConfig.go')
-rw-r--r--gitConfig.go36
1 files changed, 24 insertions, 12 deletions
diff --git a/gitConfig.go b/gitConfig.go
index 595345f..abfc72a 100644
--- a/gitConfig.go
+++ b/gitConfig.go
@@ -2,7 +2,6 @@ package repostatus
import (
"bufio"
- "errors"
"os"
"path/filepath"
"strings"
@@ -24,11 +23,12 @@ type branch struct {
}
type GitConfig struct {
- core map[string]string // map[origin] = "https:/git.wit.org/gui/gadgets"
- remotes map[string]*remote // map[origin] = "https:/git.wit.org/gui/gadgets"
- branches map[string]*branch // map[guimaster] = origin guimaster
- hashes map[string]string
- versions map[string]string
+ core map[string]string // map[origin] = "https:/git.wit.org/gui/gadgets"
+ remotes map[string]*remote // map[origin] = "https:/git.wit.org/gui/gadgets"
+ branches map[string]*branch // map[guimaster] = origin guimaster
+ submodules map[string]string
+ hashes map[string]string
+ versions map[string]string
}
type GoConfig map[string]string
@@ -85,7 +85,7 @@ func (rs *RepoStatus) readGitConfig() error {
log.Log(WARN, "readGitConfig() trying up one directory instead", filename)
file, err = os.Open(filename)
if err != nil {
- return errors.New("couldn't open .git/config")
+ return err
}
}
defer file.Close()
@@ -97,6 +97,7 @@ func (rs *RepoStatus) readGitConfig() error {
rs.gitConfig.core = make(map[string]string)
rs.gitConfig.remotes = make(map[string]*remote)
rs.gitConfig.branches = make(map[string]*branch)
+ rs.gitConfig.submodules = make(map[string]string)
rs.gitConfig.versions = make(map[string]string)
rs.gitConfig.hashes = make(map[string]string)
@@ -155,7 +156,7 @@ func (rs *RepoStatus) readGitConfig() error {
test.url = value
continue
}
- log.Log(WARN, "error url mismatch", test.url, value)
+ log.Log(REPO, "error url mismatch", test.url, value)
case "fetch":
if test.fetch == value {
continue
@@ -164,9 +165,9 @@ func (rs *RepoStatus) readGitConfig() error {
test.fetch = value
continue
}
- log.Log(WARN, "error fetch mismatch", test.fetch, value)
+ log.Log(REPO, "error fetch mismatch", test.fetch, value)
default:
- log.Log(WARN, "error unknown remote:", currentSection, currentName, "key", key, "value", value)
+ log.Log(REPO, "unknown remote:", rs.Path(), line)
}
case "branch":
test, ok := rs.gitConfig.branches[currentName]
@@ -181,10 +182,21 @@ func (rs *RepoStatus) readGitConfig() error {
case "merge":
rs.gitConfig.branches[currentName].merge = value
default:
- log.Log(WARN, "error unknown remote:", currentSection, currentName, key, value)
+ log.Log(REPO, "error unknown remote:", currentSection, currentName, key, value)
+ log.Log(REPO, "unknown branch:", rs.Path(), line)
+ }
+ case "submodule":
+ // test, ok := rs.gitConfig.submodules[currentName]
+ switch key {
+ case "active":
+ // probably 'true' or 'false'
+ case "url":
+ rs.gitConfig.submodules[currentName] = value
+ default:
+ log.Log(REPOWARN, "unknown submodule line:", rs.Path(), line)
}
default:
- log.Log(WARN, "error unknown currentSection", currentSection, "line:", line)
+ log.Log(REPOWARN, "unknown line:", rs.Path(), line)
}
}