Skip to content

Commit abdd41c

Browse files
committed
Fix the use of GetDiffShortStat.
1 parent 3979e2a commit abdd41c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

services/gitdiff/gitdiff.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -905,17 +905,11 @@ func GetDiffRangeWithWhitespaceBehavior(repoPath, beforeCommitID, afterCommitID
905905
return nil, fmt.Errorf("Wait: %v", err)
906906
}
907907

908-
shortstatArgs := []string{beforeCommitID + "..." + afterCommitID}
908+
shortstatArgs := []string{beforeCommitID, afterCommitID}
909909
if len(beforeCommitID) == 0 || beforeCommitID == git.EmptySHA {
910910
shortstatArgs = []string{git.EmptyTreeSHA, afterCommitID}
911911
}
912912
diff.NumFiles, diff.TotalAddition, diff.TotalDeletion, err = git.GetDiffShortStat(repoPath, shortstatArgs...)
913-
if err != nil && strings.Contains(err.Error(), "no merge base") {
914-
// git >= 2.28 now returns an error if base and head have become unrelated.
915-
// previously it would return the results of git diff --shortstat base head so let's try that...
916-
shortstatArgs = []string{beforeCommitID, afterCommitID}
917-
diff.NumFiles, diff.TotalAddition, diff.TotalDeletion, err = git.GetDiffShortStat(repoPath, shortstatArgs...)
918-
}
919913
if err != nil {
920914
return nil, err
921915
}

0 commit comments

Comments
 (0)