{"thread":{"id":"33191","subject":"git branch: multiple --merged and --no-merged options?","startedAt":"2013-03-15T19:38:12Z","lastAt":"2013-03-23T08:13:33Z","messageCount":4,"participants":["Jed Brown","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"211413","messageId":"87fvzwmp23.fsf@59A2.org","threadId":"33191","inReplyTo":null,"subject":"git branch: multiple --merged and --no-merged options?","fromName":"Jed Brown","fromEmail":"jed@59a2.org","sentAt":"2013-03-15T19:38:12Z","receivedAt":"2013-03-15T19:38:12Z","isPatch":false,"sender":{"key":"jed@59a2.org","avatar":"https://gravatar.com/avatar/1391d04d82555f9058a9fdf5eead233e909a48e40480db31fc554e7afeb301da?d=mp&s=160"},"body":"I find myself frequently running commands like this\n\n  $ comm -12 <(git branch --no-merged master) <(git branch --merged next)\n\nwhen checking for graduation candidates. Of course I first tried\n\n  $ git branch --no-merged master --merged next\n\nbut this is equivalent to\n\n  $ git branch --merged next\n\n\nIsn't this query common enough to have a nicer interface? What do other\npeople use?\n"},{"id":"211965","messageId":"20130322175034.GB29011@sigill.intra.peff.net","threadId":"33191","inReplyTo":"87fvzwmp23.fsf@59A2.org","subject":"Re: git branch: multiple --merged and --no-merged options?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-03-22T17:50:34Z","receivedAt":"2013-03-22T17:50:34Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Mar 15, 2013 at 02:38:12PM -0500, Jed Brown wrote:\n\n> I find myself frequently running commands like this\n> \n>   $ comm -12 <(git branch --no-merged master) <(git branch --merged next)\n\nThat's a reasonable thing to want to do.\n\n> when checking for graduation candidates. Of course I first tried\n> \n>   $ git branch --no-merged master --merged next\n\nYeah, sadly that does not work, as we use the same slot for the flag and\nstore only one of the two (and we also allow only one \"--merged\" head,\neven though you could in theory want to know \"merged to X, or merged to\nY\"). I do not think there is a reason we could handle both. I think we\ncould even do it with a single traversal, but even with two traversals,\ndoing both in-process will be faster (because we only have to pull the\ncommits from disk once).\n\nSo I think it is something that ought to work, but it will need some\ncode written. Patches welcome. ;)\n\n-Peff\n"},{"id":"212014","messageId":"8738vmu92l.fsf@59A2.org","threadId":"33191","inReplyTo":"20130322175034.GB29011@sigill.intra.peff.net","subject":"Re: git branch: multiple --merged and --no-merged options?","fromName":"Jed Brown","fromEmail":"jed@59a2.org","sentAt":"2013-03-23T02:46:42Z","receivedAt":"2013-03-23T02:46:42Z","isPatch":false,"sender":{"key":"jed@59a2.org","avatar":"https://gravatar.com/avatar/1391d04d82555f9058a9fdf5eead233e909a48e40480db31fc554e7afeb301da?d=mp&s=160"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, Mar 15, 2013 at 02:38:12PM -0500, Jed Brown wrote:\n>>   $ git branch --no-merged master --merged next\n>\n> Yeah, sadly that does not work, as we use the same slot for the flag and\n> store only one of the two (and we also allow only one \"--merged\" head,\n> even though you could in theory want to know \"merged to X, or merged to\n> Y\").\n\nHmm, I would have said conjunction (AND) was more natural than\ndisjunction (OR). If we add support for multiple '--merged' and\n'--no-merged', do we expect to eventually have a full query grammar?\n"},{"id":"212035","messageId":"20130323081333.GC29768@sigill.intra.peff.net","threadId":"33191","inReplyTo":"8738vmu92l.fsf@59A2.org","subject":"Re: git branch: multiple --merged and --no-merged options?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-03-23T08:13:33Z","receivedAt":"2013-03-23T08:13:33Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Mar 22, 2013 at 09:46:42PM -0500, Jed Brown wrote:\n\n> > On Fri, Mar 15, 2013 at 02:38:12PM -0500, Jed Brown wrote:\n> >>   $ git branch --no-merged master --merged next\n> >\n> > Yeah, sadly that does not work, as we use the same slot for the flag and\n> > store only one of the two (and we also allow only one \"--merged\" head,\n> > even though you could in theory want to know \"merged to X, or merged to\n> > Y\").\n> \n> Hmm, I would have said conjunction (AND) was more natural than\n> disjunction (OR). If we add support for multiple '--merged' and\n> '--no-merged', do we expect to eventually have a full query grammar?\n\nYeah, you might want either. I was just thinking along the lines of the\nexisting --contains and --points-at (which only tag, not branch, knows\nabout), both of which OR multiple items. I think you'd want to flesh out\nsome use cases before deciding.\n\n-Peff\n"}]}