diff options
| author | Jeff Carr <[email protected]> | 2025-10-30 23:27:40 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-30 23:27:40 -0500 |
| commit | 0096a29c0ef6d355b138ef323747b780d37b3ddd (patch) | |
| tree | 967038e719d8e49393279a75cbaa3281e2518591 /reloadParseGitConfig.go | |
| parent | da2910c708d29c6e2ab31ed22b81926621f5978e (diff) | |
autogen does all .proto files now
Diffstat (limited to 'reloadParseGitConfig.go')
| -rw-r--r-- | reloadParseGitConfig.go | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/reloadParseGitConfig.go b/reloadParseGitConfig.go index 0a93dd7..a36629b 100644 --- a/reloadParseGitConfig.go +++ b/reloadParseGitConfig.go @@ -13,21 +13,21 @@ import ( // does processing on the go.mod and go.sum files -func (repo *Repo) updateGitConfig() error { +func (repo *Repo) updateConfig() error { if repo == nil { - return fmt.Errorf("gitpb.updateGitConfig() repo == nil") + return fmt.Errorf("gitpb.updateConfig() repo == nil") } - if repo.GitConfig == nil { - repo.GitConfig = new(GitConfig) + if repo.Config == nil { + repo.Config = new(GitConfig) } - repo.GitConfig.Core = make(map[string]string) - repo.GitConfig.Remotes = make(map[string]*GitRemote) - repo.GitConfig.Branches = make(map[string]*GitBranch) - repo.GitConfig.Submodules = make(map[string]string) - repo.GitConfig.Versions = make(map[string]string) - repo.GitConfig.Hashes = make(map[string]string) - url, err := repo.readGitConfig() + repo.Config.Core = make(map[string]string) + repo.Config.Remotes = make(map[string]*GitRemote) + repo.Config.Branches = make(map[string]*GitBranch) + repo.Config.Submodules = make(map[string]string) + repo.Config.Versions = make(map[string]string) + repo.Config.Hashes = make(map[string]string) + url, err := repo.readConfig() if repo.URL == "" { repo.URL = url } @@ -42,8 +42,8 @@ func (repo *Repo) updateGitConfig() error { return err } -// readGitConfig reads and parses the .git/config file -func (repo *Repo) readGitConfig() (string, error) { +// readConfig reads and parses the .git/config file +func (repo *Repo) readConfig() (string, error) { var foundURL string filename := filepath.Join(repo.GetFullPath(), ".git/config") file, err := os.Open(filename) @@ -90,17 +90,17 @@ func (repo *Repo) readGitConfig() (string, error) { switch currentSection { case "core": - repo.GitConfig.Core[key] = value + repo.Config.Core[key] = value case "gui": // don't really need gui stuff right now case "pull": // don't store git config pull settings here // git config probably has 'rebase = false' case "remote": - test, ok := repo.GitConfig.Remotes[currentName] + test, ok := repo.Config.Remotes[currentName] if !ok { test = new(GitRemote) - repo.GitConfig.Remotes[currentName] = test + repo.Config.Remotes[currentName] = test } log.Log(INFO, "switch currentSection", currentSection, currentName) switch key { @@ -133,17 +133,17 @@ func (repo *Repo) readGitConfig() (string, error) { log.Log(INFO, "unknown remote:", line) } case "branch": - test, ok := repo.GitConfig.Branches[currentName] + test, ok := repo.Config.Branches[currentName] if !ok { test = new(GitBranch) - repo.GitConfig.Branches[currentName] = test + repo.Config.Branches[currentName] = test repo.processBranch(currentName) } switch key { case "remote": - repo.GitConfig.Branches[currentName].Remote = value + repo.Config.Branches[currentName].Remote = value case "merge": - repo.GitConfig.Branches[currentName].Merge = value + repo.Config.Branches[currentName].Merge = value default: log.Log(INFO, "error unknown remote:", currentSection, currentName, key, value) log.Info("git .config unknown branch:", line) @@ -154,7 +154,7 @@ func (repo *Repo) readGitConfig() (string, error) { case "active": // probably 'true' or 'false' case "url": - repo.GitConfig.Submodules[currentName] = value + repo.Config.Submodules[currentName] = value default: log.Log(WARN, "unknown submodule line:", line) } @@ -192,7 +192,7 @@ func (repo *Repo) readGitConfig() (string, error) { func (repo *Repo) processBranch(branch string) { log.Log(INFO, " ", branch) - hash, ok := repo.GitConfig.Hashes[branch] + hash, ok := repo.Config.Hashes[branch] filename := filepath.Join(repo.GetFullPath() + "/.git/refs/heads/" + branch) log.Log(INFO, " hash: need to open", filename) @@ -204,7 +204,7 @@ func (repo *Repo) processBranch(branch string) { } newhash := strings.TrimSpace(string(data)) log.Log(INFO, " hash:", newhash) - repo.GitConfig.Hashes[branch] = newhash + repo.Config.Hashes[branch] = newhash if ok { if hash != newhash { log.Log(WARN, "hash changed", hash) @@ -212,6 +212,6 @@ func (repo *Repo) processBranch(branch string) { } name, _ := repo.gitDescribeByHash(newhash) - repo.GitConfig.Versions[newhash] = name + repo.Config.Versions[newhash] = name log.Log(INFO, " hash: version", name) } |
