diff options
Diffstat (limited to 'new.go')
| -rw-r--r-- | new.go | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -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 |
