summaryrefslogtreecommitdiffstats
path: root/modules/git/commit.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-07-29 18:53:04 +0100
committerGitHub <noreply@github.com>2020-07-29 13:53:04 -0400
commit2f6aadffa8243736825564cd1ce32d0d5a1eb391 (patch)
treeffd0d52a2303e04bee16bf019d5670b5c54d9256 /modules/git/commit.go
parentf2a6cd6401d3d04c7b6c769d39d68262abbdaae1 (diff)
downloadgitea-2f6aadffa8243736825564cd1ce32d0d5a1eb391.tar.gz
gitea-2f6aadffa8243736825564cd1ce32d0d5a1eb391.zip
Git 2.28 no longer permits diff with ... on unrelated branches (#12364)
* Git 2.28 no longer permits diff with ... on unrelated branches Signed-off-by: Andrew Thornton <art27@cantab.net> * need to check stderr
Diffstat (limited to 'modules/git/commit.go')
-rw-r--r--modules/git/commit.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/git/commit.go b/modules/git/commit.go
index 3506b8efe4..2ae35c9f58 100644
--- a/modules/git/commit.go
+++ b/modules/git/commit.go
@@ -272,11 +272,12 @@ func AllCommitsCount(repoPath string) (int64, error) {
return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
}
-func commitsCount(repoPath, revision, relpath string) (int64, error) {
+func commitsCount(repoPath string, revision, relpath []string) (int64, error) {
cmd := NewCommand("rev-list", "--count")
- cmd.AddArguments(revision)
+ cmd.AddArguments(revision...)
if len(relpath) > 0 {
- cmd.AddArguments("--", relpath)
+ cmd.AddArguments("--")
+ cmd.AddArguments(relpath...)
}
stdout, err := cmd.RunInDir(repoPath)
@@ -289,7 +290,7 @@ func commitsCount(repoPath, revision, relpath string) (int64, error) {
// CommitsCount returns number of total commits of until given revision.
func CommitsCount(repoPath, revision string) (int64, error) {
- return commitsCount(repoPath, revision, "")
+ return commitsCount(repoPath, []string{revision}, []string{})
}
// CommitsCount returns number of total commits of until current revision.