cleaning up .git/config parsing
This commit is contained in:
parent
cb60421374
commit
e395456c53
|
@ -15,7 +15,6 @@ message GitBranch { // `autogenpb:nomutex`
|
|||
string name = 3; // the branch name from the config file
|
||||
}
|
||||
|
||||
// readGitConfig reads and parses the .git/config file
|
||||
message GitConfig { // `autogenpb:nomutex`
|
||||
map<string, string> core = 1; // map[origin] = "https:/git.wit.org/gui/gadgets"
|
||||
map<string, GitRemote> remotes = 2; // map[origin] = "https:/git.wit.org/gui/gadgets"
|
||||
|
|
16
repo.new.go
16
repo.new.go
|
@ -100,3 +100,19 @@ func (all *Repos) NewRepo(fullpath string, namespace string) (*Repo, error) {
|
|||
// todo: use Repos.Lock()
|
||||
return nil, errors.New("gitpb.NewRepo() append failed " + fullpath)
|
||||
}
|
||||
|
||||
func NewRepo(fullpath string) (*Repo, error) {
|
||||
// add a new one here
|
||||
newr := Repo{
|
||||
FullPath: fullpath,
|
||||
}
|
||||
newr.Times = new(GitTimes)
|
||||
|
||||
// everything happens in here
|
||||
newr.Reload()
|
||||
newr.ValidateUTF8()
|
||||
if newr.Namespace == "" {
|
||||
log.Info("GET Namespace from URL", newr.GetURL())
|
||||
}
|
||||
return &newr, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue