Git 2.28 no longer permits diff with ... on unrelated branches (#12370)

Backport #12364

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2020-07-29 17:42:22 +01:00 committed by GitHub
parent 77af0a23c4
commit cc8a7c9345
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 11 deletions

View file

@ -271,11 +271,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)
@ -288,7 +289,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.