Make max commits in graph configurable (#4498)

This commit is contained in:
Kjell Kvinge 2018-07-23 16:12:06 +02:00 committed by Lauris BH
parent ae9dd239fb
commit ba358ecbf5
4 changed files with 7 additions and 1 deletions

View File

@ -67,6 +67,8 @@ EXPLORE_PAGING_NUM = 20
ISSUE_PAGING_NUM = 10 ISSUE_PAGING_NUM = 10
; Number of maximum commits displayed in one activity feed ; Number of maximum commits displayed in one activity feed
FEED_MAX_COMMIT_NUM = 5 FEED_MAX_COMMIT_NUM = 5
; Number of maximum commits displayed in commit graph.
GRAPH_MAX_COMMIT_NUM = 100
; Value of `theme-color` meta tag, used by Android >= 5.0 ; Value of `theme-color` meta tag, used by Android >= 5.0
; An invalid color like "none" or "disable" will have the default style ; An invalid color like "none" or "disable" will have the default style
; More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android ; More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android

View File

@ -68,6 +68,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `EXPLORE_PAGING_NUM`: **20**: Number of repositories that are shown in one explore page. - `EXPLORE_PAGING_NUM`: **20**: Number of repositories that are shown in one explore page.
- `ISSUE_PAGING_NUM`: **10**: Number of issues that are shown in one page (for all pages that list issues). - `ISSUE_PAGING_NUM`: **10**: Number of issues that are shown in one page (for all pages that list issues).
- `FEED_MAX_COMMIT_NUM`: **5**: Number of maximum commits shown in one activity feed. - `FEED_MAX_COMMIT_NUM`: **5**: Number of maximum commits shown in one activity feed.
- `GRAPH_MAX_COMMIT_NUM`: **100**: Number of maximum commits shown in the commit graph.
- `DEFAULT_THEME`: **gitea**: \[gitea, arc-green\]: Set the default theme for the Gitea install. - `DEFAULT_THEME`: **gitea**: \[gitea, arc-green\]: Set the default theme for the Gitea install.
### UI - Admin (`ui.admin`) ### UI - Admin (`ui.admin`)

View File

@ -9,6 +9,7 @@ import (
"strings" "strings"
"code.gitea.io/git" "code.gitea.io/git"
"code.gitea.io/gitea/modules/setting"
) )
// GraphItem represent one commit, or one relation in timeline // GraphItem represent one commit, or one relation in timeline
@ -41,7 +42,7 @@ func GetCommitGraph(r *git.Repository) (GraphItems, error) {
"--all", "--all",
"-C", "-C",
"-M", "-M",
"-n 100", fmt.Sprintf("-n %d", setting.UI.GraphMaxCommitNum),
"--date=iso", "--date=iso",
fmt.Sprintf("--pretty=format:%s", format), fmt.Sprintf("--pretty=format:%s", format),
) )

View File

@ -276,6 +276,7 @@ var (
IssuePagingNum int IssuePagingNum int
RepoSearchPagingNum int RepoSearchPagingNum int
FeedMaxCommitNum int FeedMaxCommitNum int
GraphMaxCommitNum int
ReactionMaxUserNum int ReactionMaxUserNum int
ThemeColorMetaTag string ThemeColorMetaTag string
MaxDisplayFileSize int64 MaxDisplayFileSize int64
@ -301,6 +302,7 @@ var (
IssuePagingNum: 10, IssuePagingNum: 10,
RepoSearchPagingNum: 10, RepoSearchPagingNum: 10,
FeedMaxCommitNum: 5, FeedMaxCommitNum: 5,
GraphMaxCommitNum: 100,
ReactionMaxUserNum: 10, ReactionMaxUserNum: 10,
ThemeColorMetaTag: `#6cc644`, ThemeColorMetaTag: `#6cc644`,
MaxDisplayFileSize: 8388608, MaxDisplayFileSize: 8388608,