From d594bb386f92455079e56b48f5add16b05609dea Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 23 Mar 2014 16:51:43 +0800 Subject: [PATCH 1/3] log import fixed --- serve.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/serve.go b/serve.go index 54296049d..d4ce138c1 100644 --- a/serve.go +++ b/serve.go @@ -15,7 +15,7 @@ import ( "strings" "github.com/codegangsta/cli" - "github.com/qiniu/log" + "github.com/gogits/gogs/modules/log" "github.com/gogits/git" "github.com/gogits/gogs/models" @@ -195,9 +195,9 @@ func runServ(k *cli.Context) { } // update - w, _ := os.Create("serve.log") - defer w.Close() - log.SetOutput(w) + //w, _ := os.Create("serve.log") + //defer w.Close() + //log.SetOutput(w) var t = "ok refs/heads/" var i int From 21a138a75a379c1c8d1142b6bdf3f855c0361634 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 23 Mar 2014 17:10:09 +0800 Subject: [PATCH 2/3] bug fxied --- serve.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/serve.go b/serve.go index d4ce138c1..16df38f42 100644 --- a/serve.go +++ b/serve.go @@ -104,8 +104,6 @@ func runServ(k *cli.Context) { repoName = repoName[:len(repoName)-4] } - //os.Setenv("userName", user.Name) - //os.Setenv("userId", strconv.Itoa(int(user.Id))) repo, err := models.GetRepositoryByName(user.Id, repoName) var isExist bool = true if err != nil { @@ -116,8 +114,6 @@ func runServ(k *cli.Context) { return } } - //os.Setenv("repoId", strconv.Itoa(int(repo.Id))) - //os.Setenv("repoName", repoName) isWrite := In(verb, COMMANDS_WRITE) isRead := In(verb, COMMANDS_READONLY) @@ -187,13 +183,18 @@ func runServ(k *cli.Context) { b := bytes.NewBufferString(s) gitcmd.Stdout = io.MultiWriter(os.Stdout, b) - gitcmd.Stdin = io.MultiReader(os.Stdin, b) + //gitcmd.Stdin = io.MultiReader(os.Stdin, b) + gitcmd.Stdin = os.Stdin gitcmd.Stderr = os.Stderr if err = gitcmd.Run(); err != nil { println("execute command error:", err.Error()) } + if !strings.HasPrefix(cmd, "git-receive-pack") { + return + } + // update //w, _ := os.Create("serve.log") //defer w.Close() From c4287bafabb96f3970bf629ff225c48112d008d9 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 23 Mar 2014 17:13:22 +0800 Subject: [PATCH 3/3] bug fixed --- serve.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serve.go b/serve.go index 16df38f42..2f7a9d605 100644 --- a/serve.go +++ b/serve.go @@ -227,7 +227,7 @@ func runServ(k *cli.Context) { return } if ref, ok = refs[refname]; !ok { - println("unknow reference name", refname) + println("unknow reference name -", refname, "-") return } l, err = ref.AllCommits()