summaryrefslogtreecommitdiff
path: root/repo.new.go
diff options
context:
space:
mode:
Diffstat (limited to 'repo.new.go')
-rw-r--r--repo.new.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/repo.new.go b/repo.new.go
index 9404d7b..9d0f7ba 100644
--- a/repo.new.go
+++ b/repo.new.go
@@ -19,7 +19,7 @@ func (all *Repos) NewGoPath(basepath string, gopath string, url string) (*Repo,
}
if r := all.FindByGoPath(gopath); r != nil {
// already had this gopath
- return nil, errors.New("duplicate gopath " + gopath)
+ return r, errors.New("gitpb.NewGoPath() duplicate gopath " + gopath)
}
log.Info("gitpb.NewGoPath() Attempting to add new path", basepath, gopath)
@@ -58,7 +58,11 @@ func (all *Repos) NewGoPath(basepath string, gopath string, url string) (*Repo,
// worked
return &newr, nil
}
- return nil, errors.New("repo already exists: " + gopath)
+ if r := all.FindByGoPath(gopath); r != nil {
+ // already had this gopath
+ return r, errors.New("gitpb.NewGoPath() AppendUnique() failed but Find() worked" + gopath)
+ }
+ return nil, errors.New("repo gitpb.NewGoPath() should never have gotten here " + gopath)
}
func (repo *Repo) SetDevelBranchName(bname string) {