diff options
| author | Jeff Carr <[email protected]> | 2024-03-09 16:50:18 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-03-09 16:50:18 -0600 |
| commit | 7d3e4ce84e9414036c1783b5f262fb55439f0a34 (patch) | |
| tree | b6680c62f8e9dbbbb2552cf69edb96fb7084e9dd /gitConfig.go | |
| parent | 546ad6a842eba10ec9b1a028580c090cb06c6c29 (diff) | |
add submodules section of the .git/configv0.22.2
Diffstat (limited to 'gitConfig.go')
| -rw-r--r-- | gitConfig.go | 36 |
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) } } |
