cmd/coordinator: put go repo in its own directory inside tmp
Previously the Go repo would be in /tmp/watcher1234 and each sub repo in
/tmp/watcher1234/subrepo. This change puts the Go repo inside
/tmp/watcher1234/go.
Change-Id: I4dc3d9fad8cc41647f6a821273565b815fc0f968
Reviewed-on: https://go-review.googlesource.com/18240
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/coordinator/watcher_process.go b/cmd/coordinator/watcher_process.go
index 82cbf25..ba9c273 100644
--- a/cmd/coordinator/watcher_process.go
+++ b/cmd/coordinator/watcher_process.go
@@ -183,14 +183,20 @@
// specified by srcURL to a new directory inside dir.
// If dstURL is not empty, changes from the source repository will
// be mirrored to the specified destination repository.
-// The path argument is the base import path of the repository,
+// The importPath argument is the base import path of the repository,
// and should be empty for the main Go repo.
// The dash argument should be set true if commits to this
// repo should be reported to the build dashboard.
-func NewRepo(dir, srcURL, dstURL, path string, dash bool) (*Repo, error) {
+func NewRepo(dir, srcURL, dstURL, importPath string, dash bool) (*Repo, error) {
+ var root string
+ if importPath == "" {
+ root = filepath.Join(dir, "go")
+ } else {
+ root = filepath.Join(dir, path.Base(importPath))
+ }
r := &Repo{
- path: path,
- root: filepath.Join(dir, filepath.Base(path)),
+ path: importPath,
+ root: root,
commits: make(map[string]*Commit),
branches: make(map[string]*Branch),
mirror: dstURL != "",