@@ -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.
@@ -85,12 +87,6 @@ func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) {
85
87
return commits .Front ().Value .(* Commit ), nil
86
88
}
87
89
88
- // CommitsRangeSize the default commits range size
89
- var CommitsRangeSize = 50
90
-
91
- // BranchesRangeSize the default branches range size
92
- var BranchesRangeSize = 20
93
-
94
90
func (repo * Repository ) commitsByRange (id SHA1 , page , pageSize int ) (* list.List , error ) {
95
91
stdout , err := NewCommand ("log" , id .String (), "--skip=" + strconv .Itoa ((page - 1 )* pageSize ),
96
92
"--max-count=" + strconv .Itoa (pageSize ), prettyLogFormat ).RunInDirBytes (repo .Path )
@@ -206,7 +202,7 @@ func (repo *Repository) FileCommitsCount(revision, file string) (int64, error) {
206
202
207
203
// CommitsByFileAndRange return the commits according revison file and the page
208
204
func (repo * Repository ) CommitsByFileAndRange (revision , file string , page int ) (* list.List , error ) {
209
- skip := (page - 1 ) * CommitsRangeSize
205
+ skip := (page - 1 ) * setting . Git . CommitsRangeSize
210
206
211
207
stdoutReader , stdoutWriter := io .Pipe ()
212
208
defer func () {
@@ -216,7 +212,7 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (
216
212
go func () {
217
213
stderr := strings.Builder {}
218
214
err := NewCommand ("log" , revision , "--follow" ,
219
- "--max-count=" + strconv .Itoa (CommitsRangeSize * page ),
215
+ "--max-count=" + strconv .Itoa (setting . Git . CommitsRangeSize * page ),
220
216
prettyLogFormat , "--" , file ).
221
217
RunInDirPipeline (repo .Path , stdoutWriter , & stderr )
222
218
if err != nil {
@@ -247,7 +243,7 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (
247
243
// CommitsByFileAndRangeNoFollow return the commits according revison file and the page
248
244
func (repo * Repository ) CommitsByFileAndRangeNoFollow (revision , file string , page int ) (* list.List , error ) {
249
245
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 )
251
247
if err != nil {
252
248
return nil , err
253
249
}
0 commit comments