@@ -12,6 +12,8 @@ import (
1212 "io/ioutil"
1313 "strconv"
1414 "strings"
15+
16+ "code.gitea.io/gitea/modules/setting"
1517)
1618
1719// GetBranchCommitID returns last commit ID string of given branch.
@@ -85,12 +87,6 @@ func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) {
8587 return commits .Front ().Value .(* Commit ), nil
8688}
8789
88- // CommitsRangeSize the default commits range size
89- var CommitsRangeSize = 50
90-
91- // BranchesRangeSize the default branches range size
92- var BranchesRangeSize = 20
93-
9490func (repo * Repository ) commitsByRange (id SHA1 , page , pageSize int ) (* list.List , error ) {
9591 stdout , err := NewCommand ("log" , id .String (), "--skip=" + strconv .Itoa ((page - 1 )* pageSize ),
9692 "--max-count=" + strconv .Itoa (pageSize ), prettyLogFormat ).RunInDirBytes (repo .Path )
@@ -206,7 +202,7 @@ func (repo *Repository) FileCommitsCount(revision, file string) (int64, error) {
206202
207203// CommitsByFileAndRange return the commits according revison file and the page
208204func (repo * Repository ) CommitsByFileAndRange (revision , file string , page int ) (* list.List , error ) {
209- skip := (page - 1 ) * CommitsRangeSize
205+ skip := (page - 1 ) * setting . Git . CommitsRangeSize
210206
211207 stdoutReader , stdoutWriter := io .Pipe ()
212208 defer func () {
@@ -216,7 +212,7 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (
216212 go func () {
217213 stderr := strings.Builder {}
218214 err := NewCommand ("log" , revision , "--follow" ,
219- "--max-count=" + strconv .Itoa (CommitsRangeSize * page ),
215+ "--max-count=" + strconv .Itoa (setting . Git . CommitsRangeSize * page ),
220216 prettyLogFormat , "--" , file ).
221217 RunInDirPipeline (repo .Path , stdoutWriter , & stderr )
222218 if err != nil {
@@ -247,7 +243,7 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (
247243// CommitsByFileAndRangeNoFollow return the commits according revison file and the page
248244func (repo * Repository ) CommitsByFileAndRangeNoFollow (revision , file string , page int ) (* list.List , error ) {
249245 stdout , err := NewCommand ("log" , revision , "--skip=" + strconv .Itoa ((page - 1 )* 50 ),
250- "--max-count=" + strconv .Itoa (CommitsRangeSize ), prettyLogFormat , "--" , file ).RunInDirBytes (repo .Path )
246+ "--max-count=" + strconv .Itoa (setting . Git . CommitsRangeSize ), prettyLogFormat , "--" , file ).RunInDirBytes (repo .Path )
251247 if err != nil {
252248 return nil , err
253249 }
0 commit comments