From 0c0445c97a9219f7a9f7f2afd618b31bf958e14f Mon Sep 17 00:00:00 2001 From: Chester Liu Date: Tue, 19 Jan 2021 12:07:38 +0800 Subject: Add pager to the branches page (#14202) * Add pager to the branches page * override pageSize if bigger than max * Make branches commit range configurable Co-authored-by: zeripath Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: silverwind --- modules/git/repo_commit.go | 3 +++ modules/setting/git.go | 7 +++++++ 2 files changed, 10 insertions(+) (limited to 'modules') diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index c31f416628..f02fdde5a8 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -110,6 +110,9 @@ func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) { // CommitsRangeSize the default commits range size var CommitsRangeSize = 50 +// BranchesRangeSize the default branches range size +var BranchesRangeSize = 20 + func (repo *Repository) commitsByRange(id SHA1, page, pageSize int) (*list.List, error) { stdout, err := NewCommand("log", id.String(), "--skip="+strconv.Itoa((page-1)*pageSize), "--max-count="+strconv.Itoa(pageSize), prettyLogFormat).RunInDirBytes(repo.Path) diff --git a/modules/setting/git.go b/modules/setting/git.go index 80170e37bf..308d94894b 100644 --- a/modules/setting/git.go +++ b/modules/setting/git.go @@ -19,6 +19,8 @@ var ( MaxGitDiffLines int MaxGitDiffLineCharacters int MaxGitDiffFiles int + CommitsRangeSize int + BranchesRangeSize int VerbosePush bool VerbosePushDelay time.Duration GCArgs []string `ini:"GC_ARGS" delim:" "` @@ -37,6 +39,8 @@ var ( MaxGitDiffLines: 1000, MaxGitDiffLineCharacters: 5000, MaxGitDiffFiles: 100, + CommitsRangeSize: 50, + BranchesRangeSize: 20, VerbosePush: true, VerbosePushDelay: 5 * time.Second, GCArgs: []string{}, @@ -91,5 +95,8 @@ func newGit() { args = append(args, "Version 2") // for focus color } + git.CommitsRangeSize = Git.CommitsRangeSize + git.BranchesRangeSize = Git.BranchesRangeSize + log.Info(format, args...) } -- cgit v1.2.3