On Tue, Sep 22, 2020 at 03:17:54PM -0700, Chris Webster wrote: > On Tue, Sep 22, 2020 at 10:07 AM Jeff King <peff@xxxxxxxx> wrote: > > - for a linear branch on top of master, using the commit count will > > work reliably. But I suspect it would run into problems if there were > > ever a merge on a PR (e.g., back-merging from master), where we'd be > > subject to how `git log` linearizes the commits. That's not really a > > workflow I'd expect people to use with git.git, but it would probably > > be easy to make it more robust. Does the PR object provide the "base" > > oid, so we could do "git log $base..$head"? > > GitGitGadget PR linting is going to flag merges in the PR and request > a rebase. If I understand correctly, that means back-merging is not > part of the workflow. Yeah, I would definitely be surprised to see it used with a git PR, but I didn't realize there was other linting that would actually complain about it. > The checkout is limited to improve performance > and reduce resources. In the PR object, the base is the branch. The > github api would need to be used to get more detailed information. > The "base" is not really part of the checkout so it can not be > referenced in the git log command (without doing a larger checkout). Hmm. git clone --shallow-exclude=HEAD --single-branch -b $branch git log --check _almost_ works. The problem is that the shallow graft means that the bottom commit looks like it introduces every file. We really want to graft at HEAD^, but the server side only accepts exact refnames. You could work around it with a followup: git fetch --deepen 1 which is getting a bit convoluted. I suspect you may also have to abandon the "checkout" action and do this manually. Definitely not worth it compared to your solution for a PR, but maybe worth it if it lets us do the same thing for arbitrary branches. -Peff