summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/git/commit.go4
-rw-r--r--modules/git/repo_commit.go18
2 files changed, 15 insertions, 7 deletions
diff --git a/modules/git/commit.go b/modules/git/commit.go
index 610d27c68a..f28c315cb5 100644
--- a/modules/git/commit.go
+++ b/modules/git/commit.go
@@ -187,8 +187,8 @@ func (c *Commit) CommitsCount() (int64, error) {
}
// CommitsByRange returns the specific page commits before current revision, every page's number default by CommitsRangeSize
-func (c *Commit) CommitsByRange(page, pageSize int) ([]*Commit, error) {
- return c.repo.commitsByRange(c.ID, page, pageSize)
+func (c *Commit) CommitsByRange(page, pageSize int, not string) ([]*Commit, error) {
+ return c.repo.commitsByRange(c.ID, page, pageSize, not)
}
// CommitsBefore returns all the commits before current revision
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go
index 153a116b06..30a82eb297 100644
--- a/modules/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -90,14 +90,22 @@ func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) {
return commits[0], nil
}
-func (repo *Repository) commitsByRange(id SHA1, page, pageSize int) ([]*Commit, error) {
- stdout, _, err := NewCommand(repo.Ctx, "log").
- AddOptionFormat("--skip=%d", (page-1)*pageSize).AddOptionFormat("--max-count=%d", pageSize).AddArguments(prettyLogFormat).
- AddDynamicArguments(id.String()).
- RunStdBytes(&RunOpts{Dir: repo.Path})
+func (repo *Repository) commitsByRange(id SHA1, page, pageSize int, not string) ([]*Commit, error) {
+ cmd := NewCommand(repo.Ctx, "log").
+ AddOptionFormat("--skip=%d", (page-1)*pageSize).
+ AddOptionFormat("--max-count=%d", pageSize).
+ AddArguments(prettyLogFormat).
+ AddDynamicArguments(id.String())
+
+ if not != "" {
+ cmd.AddOptionValues("--not", not)
+ }
+
+ stdout, _, err := cmd.RunStdBytes(&RunOpts{Dir: repo.Path})
if err != nil {
return nil, err
}
+
return repo.parsePrettyFormatLogToList(stdout)
}