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:
parent
f2a6cd6401
commit
2f6aadffa8
5 changed files with 68 additions and 12 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue