From ba358ecbf5d58dc6b2f166a84a4b6c6633cfa397 Mon Sep 17 00:00:00 2001 From: Kjell Kvinge Date: Mon, 23 Jul 2018 16:12:06 +0200 Subject: [PATCH] Make max commits in graph configurable (#4498) --- custom/conf/app.ini.sample | 2 ++ docs/content/doc/advanced/config-cheat-sheet.en-us.md | 1 + models/graph.go | 3 ++- modules/setting/setting.go | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index f087e9913b4..12e50e8cb77 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -67,6 +67,8 @@ EXPLORE_PAGING_NUM = 20 ISSUE_PAGING_NUM = 10 ; Number of maximum commits displayed in one activity feed 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 ; 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 diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 5ed2ce43e7e..29489d88552 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -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. - `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. +- `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. ### UI - Admin (`ui.admin`) diff --git a/models/graph.go b/models/graph.go index 8ecea9c0933..90b9ff11f8c 100644 --- a/models/graph.go +++ b/models/graph.go @@ -9,6 +9,7 @@ import ( "strings" "code.gitea.io/git" + "code.gitea.io/gitea/modules/setting" ) // GraphItem represent one commit, or one relation in timeline @@ -41,7 +42,7 @@ func GetCommitGraph(r *git.Repository) (GraphItems, error) { "--all", "-C", "-M", - "-n 100", + fmt.Sprintf("-n %d", setting.UI.GraphMaxCommitNum), "--date=iso", fmt.Sprintf("--pretty=format:%s", format), ) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index b44ba4d11b1..396dec2546b 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -276,6 +276,7 @@ var ( IssuePagingNum int RepoSearchPagingNum int FeedMaxCommitNum int + GraphMaxCommitNum int ReactionMaxUserNum int ThemeColorMetaTag string MaxDisplayFileSize int64 @@ -301,6 +302,7 @@ var ( IssuePagingNum: 10, RepoSearchPagingNum: 10, FeedMaxCommitNum: 5, + GraphMaxCommitNum: 100, ReactionMaxUserNum: 10, ThemeColorMetaTag: `#6cc644`, MaxDisplayFileSize: 8388608,