diff options
Diffstat (limited to 'src/edit/dir.go')
-rw-r--r-- | src/edit/dir.go | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/edit/dir.go b/src/edit/dir.go index c1e7cca..cc99774 100644 --- a/src/edit/dir.go +++ b/src/edit/dir.go @@ -2,12 +2,12 @@ package main import ( "fmt" - "time" "io/ioutil" "net/http" + "os/user" "path" "strings" - "os/user" + "time" ) func ServeGit(out http.ResponseWriter, in *http.Request) { @@ -19,7 +19,6 @@ func ServeGit(out http.ResponseWriter, in *http.Request) { upath = path.Clean(upath) upath = upath[1:] - errcheck(GitPull()) tree, err := GitLsTree() errcheck(err) @@ -30,7 +29,7 @@ func ServeGit(out http.ResponseWriter, in *http.Request) { return } if file.Type == "tree" && !strings.HasSuffix(in.URL.Path, "/") { - out.Header().Set("Location", path.Base(upath) + "/") + out.Header().Set("Location", path.Base(upath)+"/") out.WriteHeader(http.StatusMovedPermanently) return } @@ -56,10 +55,10 @@ func ServeGit(out http.ResponseWriter, in *http.Request) { content, err := ioutil.ReadAll(in.Body) errcheck(err) edit := Edit{ - UserName: userinfo.Name, - UserEmail: username+"@edit.team4272.com", - Time: time.Now(), - Message: msg+"\n", + UserName: userinfo.Name, + UserEmail: username + "@edit.team4272.com", + Time: time.Now(), + Message: msg + "\n", Files: map[string][]byte{ upath: content, }, @@ -81,10 +80,10 @@ func ServeGit(out http.ResponseWriter, in *http.Request) { msg = fmt.Sprintf("web edit: delete %q", upath) } edit := Edit{ - UserName: userinfo.Name, - UserEmail: username+"@edit.team4272.com", - Time: time.Now(), - Message: msg+"\n", + UserName: userinfo.Name, + UserEmail: username + "@edit.team4272.com", + Time: time.Now(), + Message: msg + "\n", Files: map[string][]byte{ upath: nil, }, |