move away from maps in protobuf?

This commit is contained in:
Jeff Carr 2025-01-18 15:49:13 -06:00
parent 9094779044
commit 93e4eae19d
2 changed files with 21 additions and 2 deletions

View File

@ -10,8 +10,9 @@ message GitRemote { // `autogenpb:nomutex`
}
message GitBranch { // `autogenpb:nomutex`
string remote = 1;
string merge = 2;
string remote = 1; // the name of the remote repo
string merge = 2; // the merge path from the config file
string name = 3; // the branch name from the config file
}
// readGitConfig reads and parses the .git/config file
@ -22,6 +23,7 @@ message GitConfig { // `autogenpb:nomutex`
map<string, string> submodules = 4;
map<string, string> hashes = 5;
map<string, string> versions = 6;
repeated GitBranch local = 7; // move this this and away from the map<> variables
}
message GitTag { // `autogenpb:nomutex`

View File

@ -1,6 +1,7 @@
package gitpb
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
@ -113,6 +114,22 @@ func ListFiles(directory string) []string {
return files
}
// forge doesn't want a remote user branch
// this will make sure the user branch is only local
func (repo *Repo) checkUserBranch() error {
ubn := repo.GetUserBranchName()
log.Info("user branch name:", ubn, repo.GetGoPath())
if repo.GitConfig == nil {
return fmt.Errorf("GitConfig == nil")
}
for _, l := range repo.GitConfig.Local {
log.Info("local branch name:", l.Name)
}
return nil
}
func (repo *Repo) ExamineBranches() *GitTag {
var hashCheck string
all := repo.GetBranches()