@@ -12,6 +12,8 @@ import (
12
12
"io/ioutil"
13
13
"strconv"
14
14
"strings"
15
+
16
+ "code.gitea.io/gitea/modules/setting"
15
17
)
16
18
17
19
// GetBranchCommitID returns last commit ID string of given branch.
@@ -113,12 +115,6 @@ func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) {
113
115
return commits .Front ().Value .(* Commit ), nil
114
116
}
115
117
116
- // CommitsRangeSize the default commits range size
117
- var CommitsRangeSize = 50
118
-
119
- // BranchesRangeSize the default branches range size
120
- var BranchesRangeSize = 20
121
-
122
118
func (repo * Repository ) commitsByRange (id SHA1 , page , pageSize int ) (* list.List , error ) {
123
119
stdout , err := NewCommand ("log" , id .String (), "--skip=" + strconv .Itoa ((page - 1 )* pageSize ),
124
120
"--max-count=" + strconv .Itoa (pageSize ), prettyLogFormat ).RunInDirBytes (repo .Path )
@@ -234,7 +230,7 @@ func (repo *Repository) FileCommitsCount(revision, file string) (int64, error) {
234
230
235
231
// CommitsByFileAndRange return the commits according revison file and the page
236
232
func (repo * Repository ) CommitsByFileAndRange (revision , file string , page int ) (* list.List , error ) {
237
- skip := (page - 1 ) * CommitsRangeSize
233
+ skip := (page - 1 ) * setting . Git . CommitsRangeSize
238
234
239
235
stdoutReader , stdoutWriter := io .Pipe ()
240
236
defer func () {
@@ -244,7 +240,7 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (
244
240
go func () {
245
241
stderr := strings.Builder {}
246
242
err := NewCommand ("log" , revision , "--follow" ,
247
- "--max-count=" + strconv .Itoa (CommitsRangeSize * page ),
243
+ "--max-count=" + strconv .Itoa (setting . Git . CommitsRangeSize * page ),
248
244
prettyLogFormat , "--" , file ).
249
245
RunInDirPipeline (repo .Path , stdoutWriter , & stderr )
250
246
if err != nil {
@@ -275,7 +271,7 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (
275
271
// CommitsByFileAndRangeNoFollow return the commits according revison file and the page
276
272
func (repo * Repository ) CommitsByFileAndRangeNoFollow (revision , file string , page int ) (* list.List , error ) {
277
273
stdout , err := NewCommand ("log" , revision , "--skip=" + strconv .Itoa ((page - 1 )* 50 ),
278
- "--max-count=" + strconv .Itoa (CommitsRangeSize ), prettyLogFormat , "--" , file ).RunInDirBytes (repo .Path )
274
+ "--max-count=" + strconv .Itoa (setting . Git . CommitsRangeSize ), prettyLogFormat , "--" , file ).RunInDirBytes (repo .Path )
279
275
if err != nil {
280
276
return nil , err
281
277
}
0 commit comments