1
0
Fork 0
forked from forgejo/forgejo

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
This commit is contained in:
zeripath 2020-07-29 18:53:04 +01:00 committed by GitHub
parent f2a6cd6401
commit 2f6aadffa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 12 deletions

View file

@ -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.