summaryrefslogtreecommitdiff
path: root/new.go
diff options
context:
space:
mode:
Diffstat (limited to 'new.go')
-rw-r--r--new.go24
1 files changed, 16 insertions, 8 deletions
diff --git a/new.go b/new.go
index 7b7db80..5ee4aff 100644
--- a/new.go
+++ b/new.go
@@ -3,6 +3,7 @@ package repostatus
import (
"os"
"path/filepath"
+ "strings"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
@@ -33,26 +34,33 @@ func NewRepoStatusWindow(path string) *RepoStatus {
}
goSrcDir := filepath.Join(homeDir, "go/src")
-
realpath := filepath.Join(goSrcDir, path)
- filename := filepath.Join(realpath, ".git/config")
- gitConfig, err := readGitConfig(filename)
- // if the .git/config file fails to load, just nil out man
+ filename := filepath.Join(goSrcDir, path, ".git/config")
+
+ _, err = os.Open(filename)
if err != nil {
- log.Log(WARN, "Error reading .git/config:", err)
+ log.Log(WARN, "Error reading:", filename, err)
return nil
}
rs := New(gui.TreeRoot(), path)
- rs.draw(goSrcDir, realpath)
+ rs.draw()
// save ~/go/src & the whole path strings
+ rs.path.SetValue(path)
rs.goSrcPath.SetValue(goSrcDir)
rs.realPath.SetValue(realpath)
- // save .git/config
- rs.gitConfig = gitConfig
+ rs.readGitConfig()
+
+ rs.readOnly.SetValue("true")
+ if strings.HasPrefix(path, "go.wit.com") {
+ rs.readOnly.SetValue("false")
+ }
+ if strings.HasPrefix(path, "git.wit.org") {
+ rs.readOnly.SetValue("false")
+ }
windowMap[path] = rs