git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: grep open pull requests

From
JBJack Bates <bk874k@nottheoilrig.com>
Date
Jan 19, 2017, 22:12 UTC
Message-ID
<9f59c0d7-73d3-1b4c-65ca-700d6e1f4f23@nottheoilrig.com>
In-Reply-To
<20170119190227.opjisryyqn766tqy@sigill.intra.peff.net>
On 19/01/17 12:02 PM, Jeff King wrote:
Show 16 quoted lines
> 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!
Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “grep open pull requests”
  1. Jack BatesJan 19, 2017
  2. Jeff KingJan 19, 2017
  3. Jack BatesJan 19, 2017
  4. Jeff KingJan 19, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.