From b55499d039c5e35130057b8af16401c558e79e79 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 8 Nov 2015 14:31:49 -0500 Subject: go vet and fix #1890 --- routers/repo/commit.go | 2 -- 1 file changed, 2 deletions(-) (limited to 'routers/repo/commit.go') diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 13483cc8..d0dd01de 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -38,7 +38,6 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List { newCommits := list.New() for e := oldCommits.Front(); e != nil; e = e.Next() { c := e.Value.(*git.Commit) - c.CommitMessage = c.CommitMessage newCommits.PushBack(c) } return newCommits @@ -196,7 +195,6 @@ func Diff(ctx *middleware.Context) { commitID := ctx.Repo.CommitID commit := ctx.Repo.Commit - commit.CommitMessage = commit.CommitMessage diff, err := models.GetDiffCommit(models.RepoPath(userName, repoName), commitID, setting.Git.MaxGitDiffLines) if err != nil { -- cgit v1.2.3 From 3b62a0fe0edad32c201ca0fce9b39bc540f6d5f4 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 10 Nov 2015 16:46:17 -0500 Subject: fix #1572 fix file histrory paging issue --- README.md | 2 +- gogs.go | 2 +- modules/base/markdown.go | 1 - routers/repo/commit.go | 83 +++++++++------------------------------ templates/.VERSION | 2 +- templates/repo/commits_table.tmpl | 2 +- 6 files changed, 23 insertions(+), 69 deletions(-) (limited to 'routers/repo/commit.go') diff --git a/README.md b/README.md index 567777b4..25b84d8e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra ![](public/img/gogs-large-resize.png) -##### Current version: 0.7.2 Beta +##### Current version: 0.7.4 Beta diff --git a/gogs.go b/gogs.go index 74e5bd64..d56dd2c4 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.7.2.1109 Beta" +const APP_VER = "0.7.4.1110 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/base/markdown.go b/modules/base/markdown.go index e59a6273..8f3d6bef 100644 --- a/modules/base/markdown.go +++ b/modules/base/markdown.go @@ -107,7 +107,6 @@ func (options *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte, } link = []byte(prefix + string(link)) } - fmt.Println(2, string(link)) out.WriteString(` commitsCount { - nextPage = 0 - } + ctx.Data["Page"] = paginater.New(commitsCount, git.CommitsRangeSize, page, 5) - commits, err := ctx.Repo.GitRepo.CommitsByFileAndRange( - branchName, fileName, page) + commits, err := ctx.Repo.GitRepo.CommitsByFileAndRange(branchName, fileName, page) if err != nil { - ctx.Handle(500, "repo.FileHistory(CommitsByRange)", err) + ctx.Handle(500, "CommitsByFileAndRange", err) return } commits = RenderIssueLinks(commits, ctx.Repo.RepoLink) commits = models.ValidateCommitsWithEmails(commits) - ctx.Data["Commits"] = commits - ctx.Data["Username"] = userName - ctx.Data["Reponame"] = repoName + + ctx.Data["Username"] = ctx.Repo.Owner.Name + ctx.Data["Reponame"] = ctx.Repo.Repository.Name ctx.Data["FileName"] = fileName ctx.Data["CommitCount"] = commitsCount - ctx.Data["LastPageNum"] = lastPage - ctx.Data["NextPageNum"] = nextPage + ctx.Data["Branch"] = branchName ctx.HTML(200, COMMITS) } diff --git a/templates/.VERSION b/templates/.VERSION index c5c0c2ee..ba0a4803 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.7.2.1109 Beta \ No newline at end of file +0.7.4.1110 Beta \ No newline at end of file diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 6fc17508..58ab1ebb 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -1,5 +1,5 @@

- {{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}} + {{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}} {{if .Branch}}({{.Branch}}){{end}} {{if .PageIsCommits}}
-- cgit v1.2.3 From 7c80eba77f727c2b80b4091c850dc38d47532b8d Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 14 Nov 2015 13:21:31 -0500 Subject: minor UI fix and fix ssh race --- README.md | 2 +- cmd/web.go | 3 ++- gogs.go | 2 +- modules/ssh/ssh.go | 24 ++++++++++++++++++------ routers/repo/commit.go | 3 +++ templates/.VERSION | 2 +- templates/repo/commits.tmpl | 1 + templates/repo/settings/deploy_keys.tmpl | 1 + templates/repo/settings/githook_edit.tmpl | 1 + templates/repo/settings/githooks.tmpl | 1 + templates/repo/settings/hook_new.tmpl | 1 + templates/repo/settings/hooks.tmpl | 1 + templates/repo/settings/options.tmpl | 1 + 13 files changed, 33 insertions(+), 10 deletions(-) (limited to 'routers/repo/commit.go') diff --git a/README.md b/README.md index 03cb070e..02e624c0 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra ![](public/img/gogs-large-resize.png) -##### Current version: 0.7.9 Beta +##### Current version: 0.7.10 Beta

diff --git a/cmd/web.go b/cmd/web.go index e51b1bb9..950c3d48 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -87,6 +87,7 @@ func checkVersion() { {"github.com/go-macaron/csrf", csrf.Version, "0.0.3"}, {"github.com/go-macaron/i18n", i18n.Version, "0.0.7"}, {"github.com/go-macaron/session", session.Version, "0.1.6"}, + {"github.com/go-macaron/toolbox", toolbox.Version, "0.1.0"}, {"gopkg.in/ini.v1", ini.Version, "1.3.4"}, } for _, c := range checkers { @@ -463,7 +464,7 @@ func runWeb(ctx *cli.Context) { }) }) - }, reqSignIn, middleware.RepoAssignment(true), reqRepoAdmin) + }, reqSignIn, middleware.RepoAssignment(true), reqRepoAdmin, middleware.RepoRef()) m.Group("/:username/:reponame", func() { m.Get("/action/:action", repo.Action) diff --git a/gogs.go b/gogs.go index 37259d36..95b8e931 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.7.9.1114 Beta" +const APP_VER = "0.7.10.1114 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go index 5e3761ca..706f5e75 100644 --- a/modules/ssh/ssh.go +++ b/modules/ssh/ssh.go @@ -7,6 +7,7 @@ package ssh import ( + "fmt" "io" "io/ioutil" "net" @@ -82,14 +83,16 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) { return } - go io.Copy(ch, stdout) - go io.Copy(ch.Stderr(), stderr) - go io.Copy(input, ch) - if err = cmd.Start(); err != nil { log.Error(3, "Start: %v", err) return - } else if err = cmd.Wait(); err != nil { + } + + go io.Copy(input, ch) + io.Copy(ch, stdout) + io.Copy(ch.Stderr(), stderr) + + if err = cmd.Wait(); err != nil { log.Error(3, "Wait: %v", err) return } @@ -142,7 +145,16 @@ func Listen(port int) { }, } - privateBytes, err := ioutil.ReadFile(filepath.Join(models.SSHPath, "id_rsa")) + keyPath := filepath.Join(setting.AppDataPath, "ssh/gogs.rsa") + if !com.IsExist(keyPath) { + os.MkdirAll(filepath.Dir(keyPath), os.ModePerm) + _, stderr, err := com.ExecCmd("ssh-keygen", "-f", keyPath, "-t", "rsa", "-N", "") + if err != nil { + panic(fmt.Sprintf("Fail to generate private key: %v - %s", err, stderr)) + } + } + + privateBytes, err := ioutil.ReadFile(keyPath) if err != nil { panic("Fail to load private key") } diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 101cb5c5..0c9e7817 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -17,6 +17,8 @@ import ( "github.com/gogits/gogs/modules/setting" ) +import "github.com/davecheney/profile" + const ( COMMITS base.TplName = "repo/commits" DIFF base.TplName = "repo/diff" @@ -43,6 +45,7 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List { } func Commits(ctx *middleware.Context) { + defer profile.Start(profile.CPUProfile).Stop() ctx.Data["PageIsCommits"] = true commitsCount, err := ctx.Repo.Commit.CommitsCount() diff --git a/templates/.VERSION b/templates/.VERSION index 548d9a0e..32d6c06d 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.7.9.1114 Beta \ No newline at end of file +0.7.10.1114 Beta \ No newline at end of file diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl index e54c9ed7..769841de 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -2,6 +2,7 @@
{{template "repo/header" .}}
+ {{template "repo/sidebar" .}} {{template "repo/commits_table" .}}
diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl index 0574e9d8..5a695838 100644 --- a/templates/repo/settings/deploy_keys.tmpl +++ b/templates/repo/settings/deploy_keys.tmpl @@ -2,6 +2,7 @@
{{template "repo/header" .}}
+ {{template "repo/sidebar" .}}
{{template "repo/settings/navbar" .}}
diff --git a/templates/repo/settings/githook_edit.tmpl b/templates/repo/settings/githook_edit.tmpl index b9b75a3a..2f79481a 100644 --- a/templates/repo/settings/githook_edit.tmpl +++ b/templates/repo/settings/githook_edit.tmpl @@ -2,6 +2,7 @@
{{template "repo/header" .}}
+ {{template "repo/sidebar" .}}
{{template "repo/settings/navbar" .}}
diff --git a/templates/repo/settings/githooks.tmpl b/templates/repo/settings/githooks.tmpl index 8120b80e..980b98fd 100644 --- a/templates/repo/settings/githooks.tmpl +++ b/templates/repo/settings/githooks.tmpl @@ -2,6 +2,7 @@
{{template "repo/header" .}}
+ {{template "repo/sidebar" .}}
{{template "repo/settings/navbar" .}}
diff --git a/templates/repo/settings/hook_new.tmpl b/templates/repo/settings/hook_new.tmpl index 7c9a5de1..ac69b02f 100644 --- a/templates/repo/settings/hook_new.tmpl +++ b/templates/repo/settings/hook_new.tmpl @@ -2,6 +2,7 @@
{{template "repo/header" .}}
+ {{template "repo/sidebar" .}}
{{template "repo/settings/navbar" .}}
diff --git a/templates/repo/settings/hooks.tmpl b/templates/repo/settings/hooks.tmpl index e3f6f4dd..187bd563 100644 --- a/templates/repo/settings/hooks.tmpl +++ b/templates/repo/settings/hooks.tmpl @@ -2,6 +2,7 @@
{{template "repo/header" .}}
+ {{template "repo/sidebar" .}}
{{template "repo/settings/navbar" .}} {{template "repo/settings/hook_list" .}} diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 474d719e..e109ec11 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -2,6 +2,7 @@
{{template "repo/header" .}}
+ {{template "repo/sidebar" .}}
{{template "repo/settings/navbar" .}}
-- cgit v1.2.3 From 84a43b38cfe88f7199a5e883f00a0ef5091a69d0 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 14 Nov 2015 13:22:24 -0500 Subject: remove unused code --- routers/repo/commit.go | 3 --- 1 file changed, 3 deletions(-) (limited to 'routers/repo/commit.go') diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 0c9e7817..101cb5c5 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -17,8 +17,6 @@ import ( "github.com/gogits/gogs/modules/setting" ) -import "github.com/davecheney/profile" - const ( COMMITS base.TplName = "repo/commits" DIFF base.TplName = "repo/diff" @@ -45,7 +43,6 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List { } func Commits(ctx *middleware.Context) { - defer profile.Start(profile.CPUProfile).Stop() ctx.Data["PageIsCommits"] = true commitsCount, err := ctx.Repo.Commit.CommitsCount() -- cgit v1.2.3