summaryrefslogtreecommitdiff
path: root/readonly.go
diff options
context:
space:
mode:
Diffstat (limited to 'readonly.go')
-rw-r--r--readonly.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/readonly.go b/readonly.go
index 27e23ee..9d0c1e9 100644
--- a/readonly.go
+++ b/readonly.go
@@ -1,6 +1,8 @@
package forgepb
-import "strings"
+import (
+ "strings"
+)
func (all *Repos) UpdateGoPath(name string, gopath string) bool {
oldr := all.DeleteByPath(name)
@@ -43,6 +45,11 @@ func (all *Repos) IsReadOnly(gopath string) bool {
}
}
+ if match == nil {
+ // log.Info("did not match in IsReadOnly()", gopath)
+ return true
+ }
+
// take the settings from the directory match
if match.Writable {
return false
@@ -63,6 +70,9 @@ func (all *Repos) IsReadOnly(gopath string) bool {
func (all *Repos) IsPrivate(gopath string) bool {
var match *Repo
+ // sort by path means the simple 'match' logic
+ // here works in the sense the last directory match
+ // is the one that is used
loop := all.SortByPath() // get the list of repos
for loop.Scan() {
r := loop.Repo()
@@ -81,11 +91,11 @@ func (all *Repos) IsPrivate(gopath string) bool {
}
}
}
-
- if match.Private {
- return true
+ if match == nil {
+ // log.Info("did not match in IsPrivate()", gopath)
+ return false
}
// otherwise, assume not private
- return true
+ return match.Private
}