From 2e6d50addcd2e9418476d56312622329de5e9aab Mon Sep 17 00:00:00 2001 From: zhsso Date: Fri, 11 Apr 2014 22:57:25 -0400 Subject: [PATCH 1/7] combine getCommit ById and ByBranch in routers/repo/commit.go --- routers/repo/commit.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/routers/repo/commit.go b/routers/repo/commit.go index e6f6d7ed8..5a7bb589f 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -50,18 +50,8 @@ func Commits(ctx *middleware.Context, params martini.Params) { nextPage = 0 } - var commits *list.List - if models.IsBranchExist(userName, repoName, branchName) { - // commits, err = models.GetCommitsByBranch(userName, repoName, branchName) - commits, err = models.GetCommitsByRange(repoPath, branchName, page) - } else { - commits, err = models.GetCommitsByCommitId(userName, repoName, branchName) - } - - if err != nil { - ctx.Handle(404, "repo.Commits(get commits)", err) - return - } + //both `git log branchName` and `git log commitId` work + commits, err := models.GetCommitsByRange(repoPath, branchName, page) ctx.Data["Username"] = userName ctx.Data["Reponame"] = repoName From d305448fa802a91ba81af1b78294f1658bcf834c Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 11 Apr 2014 23:52:08 -0400 Subject: [PATCH 2/7] Mirror bug fix --- models/repo.go | 6 ++++-- modules/base/conf.go | 4 ++-- routers/install.go | 4 ++-- routers/repo/commit.go | 4 ++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/models/repo.go b/models/repo.go index ce8665cc6..d01a716b5 100644 --- a/models/repo.go +++ b/models/repo.go @@ -192,8 +192,10 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv return nil, err } - if err = NewRepoAction(user, repo); err != nil { - log.Error("repo.CreateRepository(NewRepoAction): %v", err) + if !repo.IsPrivate { + if err = NewRepoAction(user, repo); err != nil { + log.Error("repo.CreateRepository(NewRepoAction): %v", err) + } } if err = WatchRepo(user.Id, repo.Id, true); err != nil { diff --git a/modules/base/conf.go b/modules/base/conf.go index 871595e47..d1564aa10 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -302,9 +302,9 @@ func NewConfigContext() { InstallLock = Cfg.MustBool("security", "INSTALL_LOCK", false) RunUser = Cfg.MustValue("", "RUN_USER") - curUser := os.Getenv("USERNAME") + curUser := os.Getenv("USER") if len(curUser) == 0 { - curUser = os.Getenv("USER") + curUser = os.Getenv("USERNAME") } // Does not check run user when the install lock is off. if InstallLock && RunUser != curUser { diff --git a/routers/install.go b/routers/install.go index 78ba383de..76c03f052 100644 --- a/routers/install.go +++ b/routers/install.go @@ -146,9 +146,9 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { } // Check run user. - curUser := os.Getenv("USERNAME") + curUser := os.Getenv("USER") if len(curUser) == 0 { - curUser = os.Getenv("USER") + curUser = os.Getenv("USERNAME") } // Does not check run user when the install lock is off. if form.RunUser != curUser { diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 5a7bb589f..fed1a6bad 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -52,6 +52,10 @@ func Commits(ctx *middleware.Context, params martini.Params) { //both `git log branchName` and `git log commitId` work commits, err := models.GetCommitsByRange(repoPath, branchName, page) + if err != nil { + ctx.Handle(500, "repo.Commits(get commits)", err) + return + } ctx.Data["Username"] = userName ctx.Data["Reponame"] = repoName From b057cffd85746363a5279e9178721f8418294d65 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Sat, 12 Apr 2014 12:47:35 +0800 Subject: [PATCH 3/7] fix logo ui, add following ui in user-profile page --- public/css/gogs.css | 17 +++++++++++++++++ templates/user/profile.tmpl | 12 ++++++++++++ 2 files changed, 29 insertions(+) diff --git a/public/css/gogs.css b/public/css/gogs.css index 634548b8c..8be2bc4e7 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -74,6 +74,7 @@ html, body { padding-left: 0; padding-right: 0; margin-right: 10px; + margin-top: 0; } .nav-item:hover, @@ -310,6 +311,22 @@ html, body { padding-right: 18px; } +#user-profile .profile-rel .col-md-6 { + text-align: center; + padding-bottom: 12px; +} + +#user-profile .profile-rel strong { + font-size: 24px; + color: #444; + display: block; +} + +#user-profile .profile-rel p { + margin-right: 0; + color: #888; +} + #user-activity .tab-pane { padding: 20px; } diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 88ee318f4..0cbd34891 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -10,6 +10,18 @@
    +
  • +
    +
    + 123 +

    followers

    +
    +
    + 123 +

    following

    +
    +
    +
  • {{if .Owner.Location}}
  • {{.Owner.Location}}
  • {{end}} From 31d613c01d313e14cc57fcb183f7489352ff6aa5 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 12 Apr 2014 01:45:43 -0400 Subject: [PATCH 4/7] Mirror fix --- models/git.go | 6 ++++++ routers/repo/commit.go | 1 + templates/repo/diff.tmpl | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/models/git.go b/models/git.go index f20e663b1..10e8ca48b 100644 --- a/models/git.go +++ b/models/git.go @@ -300,6 +300,12 @@ func ParsePatch(reader io.Reader) (*Diff, error) { } i = i + 1 + + // Diff data too large. + if i == 10000 { + return &Diff{}, nil + } + if line == "" { continue } diff --git a/routers/repo/commit.go b/routers/repo/commit.go index fed1a6bad..dbfd9af29 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -103,6 +103,7 @@ func Diff(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = commit.Message() + " ยท " + base.ShortSha(commitId) ctx.Data["Commit"] = commit ctx.Data["Diff"] = diff + ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 ctx.Data["IsRepoToolbarCommits"] = true ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId) ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId) diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index a041284d0..796a8e94c 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -20,6 +20,9 @@
+ {{if .DiffNotAvailable}} +

Diff Data Not Available.

+ {{else}}
Show Diff Stats

@@ -97,6 +100,7 @@

{{end}} + {{end}} {{template "base/footer" .}} From 794b457252b270ae452b3ea946d91b216f27ac5d Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 12 Apr 2014 01:47:59 -0400 Subject: [PATCH 5/7] Mirror fix --- models/git.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/git.go b/models/git.go index 10e8ca48b..07f232977 100644 --- a/models/git.go +++ b/models/git.go @@ -302,7 +302,7 @@ func ParsePatch(reader io.Reader) (*Diff, error) { i = i + 1 // Diff data too large. - if i == 10000 { + if i == 2000 { return &Diff{}, nil } From 5f3a6a9d7424a4ba1c0e63f6c3ddfbde6f3598d8 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Sat, 12 Apr 2014 13:50:27 +0800 Subject: [PATCH 6/7] social login button ui --- public/css/gogs.css | 34 ++++++++++++++++++++++++++++++---- templates/user/signin.tmpl | 27 +++++++++++++++++++++------ 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/public/css/gogs.css b/public/css/gogs.css index 8be2bc4e7..b9c7b6ae4 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -259,14 +259,40 @@ html, body { } #social-login { - margin-top: 30px; - padding-top: 20px; + margin-top: 40px; + padding-top: 40px; border-top: 1px solid #ccc; + position: relative; } #social-login .btn { float: none; - margin: auto; + margin: auto 4px; +} + +#social-login .btn .fa { + margin-left: 0; + margin-right: 4px; +} + +#social-login .btn span { + display: inline-block; + vertical-align: top; + font-size: 16px; + margin-top: 5px; +} + +#social-login h4 { + position: absolute; + top: -20px; + width: 100%; + text-align: center; + background-color: transparent; +} + +#social-login h4 span { + background-color: #FFF; + padding: 0 12px; } /* gogs-user-profile */ @@ -323,7 +349,7 @@ html, body { } #user-profile .profile-rel p { - margin-right: 0; + margin-right: 0; color: #888; } diff --git a/templates/user/signin.tmpl b/templates/user/signin.tmpl index 6ccad79e7..4ea417380 100644 --- a/templates/user/signin.tmpl +++ b/templates/user/signin.tmpl @@ -4,13 +4,13 @@
{{.CsrfTokenHtml}}

Log in - {{if .OauthEnabled}} +

{{template "base/alert" .}}
@@ -51,12 +51,27 @@
- + {{if .OauthGitHubEnabled}} + + GitHub + {{end}} - {{end}} --> + {{end}}
{{template "base/footer" .}} From 559a57330e11cdfd0d195cd1a59a73b6c4d49bd8 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 12 Apr 2014 02:08:12 -0400 Subject: [PATCH 7/7] Mirror fix --- models/git.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models/git.go b/models/git.go index 07f232977..e32b5ba96 100644 --- a/models/git.go +++ b/models/git.go @@ -21,6 +21,7 @@ import ( "github.com/gogits/git" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/log" ) // RepoFile represents a file object in git repository. @@ -302,7 +303,8 @@ func ParsePatch(reader io.Reader) (*Diff, error) { i = i + 1 // Diff data too large. - if i == 2000 { + if i == 5000 { + log.Warn("Diff data too large") return &Diff{}, nil }