{"thread":{"id":"28482","subject":"Do we have a convenient way to refer to a specific commit in an already filtered rev-list?","startedAt":"2011-09-24T16:46:20Z","lastAt":"2011-10-04T07:05:29Z","messageCount":5,"participants":["Tzu-Jung Lee","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"176130","messageId":"CAEvN+1jPD53-e8a31g+iz6vMB0-e2LECjouBELkBOXBV5=oGBg@mail.gmail.com","threadId":"28482","inReplyTo":null,"subject":"Do we have a convenient way to refer to a specific commit in an already filtered rev-list?","fromName":"Tzu-Jung Lee","fromEmail":"roylee17@gmail.com","sentAt":"2011-09-24T16:46:20Z","receivedAt":"2011-09-24T16:46:20Z","isPatch":false,"sender":{"key":"roylee17@gmail.com","avatar":null},"body":"Hi Folks,\n\nDo we have a convenient/symbolic way to refer  to a specific commit of\nan already filtered rev-list? For example, I'm interested in the\ncommits with some constraints:\n\n    git log somepath --author=someone\n\nWithout gui/tui tools, I have to frequently CUT & PASTE the commit-ID\nfor further manipulation (show, cherry-pick, ...), and possibly repeat\nthe parsing couple of times if I didn't save the output. I wonder if\nwe have a convenient way to refer to the discrete commits? like\nHEAD~4, HEAD@{3} or something magic.\n\nThanks,\nRoy\n"},{"id":"176358","messageId":"20110927213517.GB5176@sigill.intra.peff.net","threadId":"28482","inReplyTo":"CAEvN+1jPD53-e8a31g+iz6vMB0-e2LECjouBELkBOXBV5=oGBg@mail.gmail.com","subject":"Re: Do we have a convenient way to refer to a specific commit in an already filtered rev-list?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-09-27T21:35:17Z","receivedAt":"2011-09-27T21:35:17Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Sep 25, 2011 at 12:46:20AM +0800, Tzu-Jung Lee wrote:\n\n> Do we have a convenient/symbolic way to refer  to a specific commit of\n> an already filtered rev-list? For example, I'm interested in the\n> commits with some constraints:\n> \n>     git log somepath --author=someone\n> \n> Without gui/tui tools, I have to frequently CUT & PASTE the commit-ID\n> for further manipulation (show, cherry-pick, ...), and possibly repeat\n> the parsing couple of times if I didn't save the output. I wonder if\n> we have a convenient way to refer to the discrete commits? like\n> HEAD~4, HEAD@{3} or something magic.\n\nUse the shell:\n\n  git rev-list --author=someone HEAD >saved-query\n  git log --no-walk --stdin <saved-query\n  git cherry-pick `cat saved-query`\n\nor even:\n\n  q=`git rev-list --author=someone HEAD`\n  git log --no-walk $q\n  git cherry-pick $q\n\n-Peff\n"},{"id":"176754","messageId":"CAEvN+1gODnGy2v2=d6NXJ8b1nBJgpqj+BkDm2eQC1xqyTKXhEg@mail.gmail.com","threadId":"28482","inReplyTo":"20110927213517.GB5176@sigill.intra.peff.net","subject":"Re: Do we have a convenient way to refer to a specific commit in an already filtered rev-list?","fromName":"Tzu-Jung Lee","fromEmail":"roylee17@gmail.com","sentAt":"2011-10-03T17:19:35Z","receivedAt":"2011-10-03T17:19:35Z","isPatch":false,"sender":{"key":"roylee17@gmail.com","avatar":null},"body":"On Wed, Sep 28, 2011 at 5:35 AM, Jeff King <peff@peff.net> wrote:\n> On Sun, Sep 25, 2011 at 12:46:20AM +0800, Tzu-Jung Lee wrote:\n>\n>> Do we have a convenient/symbolic way to refer  to a specific commit of\n>> an already filtered rev-list? For example, I'm interested in the\n>> commits with some constraints:\n>>\n>>     git log somepath --author=someone\n>>\n>> Without gui/tui tools, I have to frequently CUT & PASTE the commit-ID\n>> for further manipulation (show, cherry-pick, ...), and possibly repeat\n>> the parsing couple of times if I didn't save the output. I wonder if\n>> we have a convenient way to refer to the discrete commits? like\n>> HEAD~4, HEAD@{3} or something magic.\n>\n> Use the shell:\n>\n>  git rev-list --author=someone HEAD >saved-query\n>  git log --no-walk --stdin <saved-query\n>  git cherry-pick `cat saved-query`\n>\n> or even:\n>\n>  q=`git rev-list --author=someone HEAD`\n>  git log --no-walk $q\n>  git cherry-pick $q\n>\n> -Peff\n>\n\nCool, this does record and replay.\n\n\nHow about adding a command or teaching some existing one an option\nlike --saved=<ref_name>, which put the saved-list to\nrefs/saved/<ref_name> ?\nAnd also teach the rev-list to parse or interpret the 'saved' refs differently.\nSo we can have the following use case:\n\n   git log branch_foo --author=some_one -S some_string --saved=cached_ref\n   git log cached_ref\n   git cherry-pick cached_ref~4\n   git format-patch cached_ref~6..cached_ref~2\n\nI often have such use cases. not sure others would be benefited from\nsuch feature.\nJust asking for comment. :)\n\nRegards,\nRoy\n"},{"id":"176782","messageId":"7v1uutg8xw.fsf@alter.siamese.dyndns.org","threadId":"28482","inReplyTo":"CAEvN+1gODnGy2v2=d6NXJ8b1nBJgpqj+BkDm2eQC1xqyTKXhEg@mail.gmail.com","subject":"Re: Do we have a convenient way to refer to a specific commit in an already filtered rev-list?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-10-03T19:40:43Z","receivedAt":"2011-10-03T19:40:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tzu-Jung Lee <roylee17@gmail.com> writes:\n\n> And also teach the rev-list to parse or interpret the 'saved' refs differently.\n> So we can have the following use case:\n>\n>    git log branch_foo --author=some_one -S some_string --saved=cached_ref\n>    git log cached_ref\n>    git cherry-pick cached_ref~4\n>    git format-patch cached_ref~6..cached_ref~2\n>\n> I often have such use cases. not sure others would be benefited from\n> such feature.\n> Just asking for comment. :)\n\nIt feels too much hackery for too little gain.\n\n$ git log --oneline master..branch --author=A.U.Thor -Spickaxe >foos.txt\n\nand working from the text file foos.txt at least would not contaminate any\nref namespace and you do not have to clean them after you are done.\n"},{"id":"176806","messageId":"20111004070529.GA6916@sigill.intra.peff.net","threadId":"28482","inReplyTo":"7v1uutg8xw.fsf@alter.siamese.dyndns.org","subject":"Re: Do we have a convenient way to refer to a specific commit in an already filtered rev-list?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-10-04T07:05:29Z","receivedAt":"2011-10-04T07:05:29Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Oct 03, 2011 at 12:40:43PM -0700, Junio C Hamano wrote:\n\n> Tzu-Jung Lee <roylee17@gmail.com> writes:\n> \n> > And also teach the rev-list to parse or interpret the 'saved' refs differently.\n> > So we can have the following use case:\n> >\n> >    git log branch_foo --author=some_one -S some_string --saved=cached_ref\n> >    git log cached_ref\n> >    git cherry-pick cached_ref~4\n> >    git format-patch cached_ref~6..cached_ref~2\n> >\n> > I often have such use cases. not sure others would be benefited from\n> > such feature.\n> > Just asking for comment. :)\n> \n> It feels too much hackery for too little gain.\n\nAgreed. It means that each entry in refs/saved is subtly _not_ a ref,\nbut rather a list of refs. Until now, most refs are considered equal\nwith respect to basic things like ref lookup.  So if git were to save\nthis, I'm not sure refs/ would be the right place. A reflog would be a\nbit closer in concept.\n\nBut I really don't see the need for git to handle this at all. There is\nalready a general solution:\n\n> $ git log --oneline master..branch --author=A.U.Thor -Spickaxe >foos.txt\n> \n> and working from the text file foos.txt at least would not contaminate any\n> ref namespace and you do not have to clean them after you are done.\n\nWhich works just as well, and is way more flexible. You have to be a\nlittle more proficient in using the shell, but that is at least a\ngeneral skill which transfers to many other programs.\n\n-Peff\n"}]}