Git Mailing List Archive on lore.kernel.org
 help / color / Atom feed
* git branch: multiple --merged and --no-merged options?
@ 2013-03-15 19:38 Jed Brown
  2013-03-22 17:50 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Jed Brown @ 2013-03-15 19:38 UTC (permalink / raw)
  To: git

I find myself frequently running commands like this

  $ comm -12 <(git branch --no-merged master) <(git branch --merged next)

when checking for graduation candidates. Of course I first tried

  $ git branch --no-merged master --merged next

but this is equivalent to

  $ git branch --merged next


Isn't this query common enough to have a nicer interface? What do other
people use?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git branch: multiple --merged and --no-merged options?
  2013-03-15 19:38 git branch: multiple --merged and --no-merged options? Jed Brown
@ 2013-03-22 17:50 ` Jeff King
  2013-03-23  2:46   ` Jed Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2013-03-22 17:50 UTC (permalink / raw)
  To: Jed Brown; +Cc: git

On Fri, Mar 15, 2013 at 02:38:12PM -0500, Jed Brown wrote:

> I find myself frequently running commands like this
> 
>   $ comm -12 <(git branch --no-merged master) <(git branch --merged next)

That's a reasonable thing to want to do.

> when checking for graduation candidates. Of course I first tried
> 
>   $ git branch --no-merged master --merged next

Yeah, sadly that does not work, as we use the same slot for the flag and
store only one of the two (and we also allow only one "--merged" head,
even though you could in theory want to know "merged to X, or merged to
Y"). I do not think there is a reason we could handle both. I think we
could even do it with a single traversal, but even with two traversals,
doing both in-process will be faster (because we only have to pull the
commits from disk once).

So I think it is something that ought to work, but it will need some
code written. Patches welcome. ;)

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git branch: multiple --merged and --no-merged options?
  2013-03-22 17:50 ` Jeff King
@ 2013-03-23  2:46   ` Jed Brown
  2013-03-23  8:13     ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Jed Brown @ 2013-03-23  2:46 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Jeff King <peff@peff.net> writes:

> On Fri, Mar 15, 2013 at 02:38:12PM -0500, Jed Brown wrote:
>>   $ git branch --no-merged master --merged next
>
> Yeah, sadly that does not work, as we use the same slot for the flag and
> store only one of the two (and we also allow only one "--merged" head,
> even though you could in theory want to know "merged to X, or merged to
> Y").

Hmm, I would have said conjunction (AND) was more natural than
disjunction (OR). If we add support for multiple '--merged' and
'--no-merged', do we expect to eventually have a full query grammar?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git branch: multiple --merged and --no-merged options?
  2013-03-23  2:46   ` Jed Brown
@ 2013-03-23  8:13     ` Jeff King
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2013-03-23  8:13 UTC (permalink / raw)
  To: Jed Brown; +Cc: git

On Fri, Mar 22, 2013 at 09:46:42PM -0500, Jed Brown wrote:

> > On Fri, Mar 15, 2013 at 02:38:12PM -0500, Jed Brown wrote:
> >>   $ git branch --no-merged master --merged next
> >
> > Yeah, sadly that does not work, as we use the same slot for the flag and
> > store only one of the two (and we also allow only one "--merged" head,
> > even though you could in theory want to know "merged to X, or merged to
> > Y").
> 
> Hmm, I would have said conjunction (AND) was more natural than
> disjunction (OR). If we add support for multiple '--merged' and
> '--no-merged', do we expect to eventually have a full query grammar?

Yeah, you might want either. I was just thinking along the lines of the
existing --contains and --points-at (which only tag, not branch, knows
about), both of which OR multiple items. I think you'd want to flesh out
some use cases before deciding.

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15 19:38 git branch: multiple --merged and --no-merged options? Jed Brown
2013-03-22 17:50 ` Jeff King
2013-03-23  2:46   ` Jed Brown
2013-03-23  8:13     ` Jeff King

Git Mailing List Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/git/0 git/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 git git/ https://lore.kernel.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.git


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git