On 19/01/17 12:02 PM, Jeff King wrote:
It's much trickier to find from the git topology whether a particular
history contains rebased versions of commits.  You can look at the
--cherry options to "git log", which use patch-ids to try to equate
commits. Something like:

  git for-each-ref --format='%(refname)' 'refs/pull/*/head' |
  while read refname; do
        if test -z "$(git rev-list --right-only --cherry-pick -1 
origin...$refname)
        then
                echo "$refname: not merged"
        fi
  done

That's obviously much less efficient than `--no-merged`, but it should
generally work. The exception is if the rebase changed the commit
sufficiently that its patch-id may have changed.

Cool, thanks for all your help! "git log --cherry-pick" works quite well. One thing: I expected the following to be equivalent, but found that they're not. Is that by accident or design?

  $ git rev-list --cherry-pick --right-only master...refs/pull/1112/head
  $ git rev-list --cherry-pick master..refs/pull/1112/head

I think that's probably the best answer to your "unmerged" question,
too. Ask the API which PRs are unmerged, and then do whatever git-level
analysis you want based on that.

Right, that makes sense. Thanks again!

Reply via email to