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

Re: [PATCH 2/2] branch --merged/--not-merged: allow specifying arbitrary commit

From
Pierre Habouzit <madcoder@debian.org>
Date
Jul 9, 2008, 07:45 UTC
Message-ID
<20080709074516.GA23482@artemis.madism.org>
In-Reply-To
<7vmykronr1.fsf_-_@gitster.siamese.dyndns.org>
On Wed, Jul 09, 2008 at 01:22:10AM +0000, Junio C Hamano wrote:
Show 20 quoted lines
> "git-branch --merged" is a handy way to list all the branches that have
> already been merged to the current branch, but it did not allow checking
> against anything but the current branch.  Having to check out only for
> that purpose made the command practically useless.
> 
> This updates the option parser so that "git branch --merged next" is
> accepted when you are on 'master' branch.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> 
>  * This does have an issue.  --no-<option>=<value> is often nonsense and
>    parse-options does not accept it (and I do not think we would want to
>    change it).  The use of "--no-merged" was a mistake, but nobody has
>    perfect foresight.
> 
>    This adds --not-merged <commit> and allows the <commit> to default to
>    HEAD if not given to work it around.  This and the previous one are not
>    for application but primarily meant for discussion on what further
>    flexibility we may want to have in parse-options.
  There's a way: declare --merge as (PARSE_OPT_)NONEG to tell parse-opt
not to generate --no-merge by itself, and declare a --no-merge option as
well.  I think it works, and if not, we should make parse-opt work with
that. This is a quite disgusting hack, and no *new* options should be
written this way, but we have to be flexible enough for backward
compatibility's sake.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 9 in “What should "git branch --merged master" do?”
  1. Junio C HamanoJul 8, 2008
  2. Pierre HabouzitJul 8, 2008
  3. parse-options: add PARSE_OPT_FAKELASTARG flag.Pierre Habouzit, Jul 8, 2008
  4. Junio C HamanoJul 9, 2008
  5. 1/2 branch --contains: default to HEADJunio C Hamano, Jul 9, 2008
  6. 2/2 branch --merged/--not-merged: allow specifying arbitrary commitJunio C Hamano, Jul 9, 2008
  7. Pierre HabouzitJul 9, 2008
  8. Junio C HamanoJul 9, 2008
  9. Pierre HabouzitJul 9, 2008

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.