experiement with ~/.cache/forge/
This commit is contained in:
parent
68af638f9e
commit
1ead02a6d3
|
@ -138,8 +138,18 @@ func (repo *Repo) readGitConfig() error {
|
|||
default:
|
||||
log.Log(WARN, "unknown submodule line:", line)
|
||||
}
|
||||
case "user":
|
||||
// test, ok := rs.gitConfig.submodules[currentName]
|
||||
switch key {
|
||||
case "name":
|
||||
log.Log(INFO, "name:", line)
|
||||
case "email":
|
||||
log.Log(INFO, "email:", line)
|
||||
default:
|
||||
log.Log(WARN, "unknown name line:", filename, line)
|
||||
}
|
||||
default:
|
||||
log.Log(WARN, "unknown line:", line)
|
||||
log.Log(WARN, "unknown line:", filename, line)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
27
repo.new.go
27
repo.new.go
|
@ -68,3 +68,30 @@ func (all *Repos) AppendByGoPath(newr *Repo) bool {
|
|||
all.Append(newr)
|
||||
return true
|
||||
}
|
||||
|
||||
func (all *Repos) NewRepo(fullpath string, namespace string) (*Repo, error) {
|
||||
if r := all.FindByFullPath(fullpath); r != nil {
|
||||
log.Info("gitpb.NewRepo() might already have namespace", r.GetNamespace())
|
||||
log.Info("gitpb.NewRepo() already has FullPath", r.FullPath)
|
||||
// already had this gopath
|
||||
return r, errors.New("gitpb.NewRepo() duplicate path " + fullpath)
|
||||
}
|
||||
|
||||
// add a new one here
|
||||
newr := Repo{
|
||||
FullPath: fullpath,
|
||||
Namespace: namespace,
|
||||
}
|
||||
newr.Times = new(GitTimes)
|
||||
|
||||
// everything happens in here
|
||||
newr.Reload()
|
||||
|
||||
if all.AppendByFullPath(&newr) {
|
||||
// worked
|
||||
return &newr, nil
|
||||
}
|
||||
|
||||
// todo: use Repos.Lock()
|
||||
return nil, errors.New("gitpb.NewRepo() append failed " + fullpath)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue