API to get git diff of two refs

Hi there,

I’m trying to figure out an API call that will get a list of files that changed during a force-push. The pull_request/synchronized webhook contains all the shas you would need for this.

Unfortunately the repos/compare endpoint on the REST API does not seem to support this, because it does a git log BASE..HEAD and goes through the changes in each commit; but in the case where, say, I use an interactive rebase to squash a series of commits, that means the compare/SHA_BEFORE_REBASE..SHA_AFTER_REBASE has the whole diff for the squashed commit range, when in fact it should have no diff at all since the actual trees on the two SHAs are identical. (Conversely, if I go to github.com/my/repo/compare/SHA_BEFORE_REBASE..SHA_AFTER_REBASE, then I get the ‘nothing to compare’ screen I expect.)

Is there some other endpoint I can use to get an accurate diff of the files for two arbitrary SHAs?

I notice that getting the comparison for BASE..SHA (2 dots) 404s on the API, whereas it gives the correct diff on the website. The website gives the same, wrong diff if I do BASE...SHA with 3 dots.