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

Re: Do we have a convenient way to refer to a specific commit in an already filtered rev-list?

From
Jeff King <peff@peff.net>
Date
Oct 4, 2011, 07:05 UTC
Message-ID
<20111004070529.GA6916@sigill.intra.peff.net>
In-Reply-To
<7v1uutg8xw.fsf@alter.siamese.dyndns.org>
On Mon, Oct 03, 2011 at 12:40:43PM -0700, Junio C Hamano wrote:
Show 15 quoted lines
> Tzu-Jung Lee <roylee17@gmail.com> writes:
> 
> > And also teach the rev-list to parse or interpret the 'saved' refs differently.
> > So we can have the following use case:
> >
> >    git log branch_foo --author=some_one -S some_string --saved=cached_ref
> >    git log cached_ref
> >    git cherry-pick cached_ref~4
> >    git format-patch cached_ref~6..cached_ref~2
> >
> > I often have such use cases. not sure others would be benefited from
> > such feature.
> > Just asking for comment. :)
> 
> It feels too much hackery for too little gain.

Agreed. It means that each entry in refs/saved is subtly _not_ a ref, but rather a list of refs. Until now, most refs are considered equal with respect to basic things like ref lookup. So if git were to save this, I'm not sure refs/ would be the right place. A reflog would be a bit closer in concept.

But I really don't see the need for git to handle this at all. There is already a general solution:

> $ git log --oneline master..branch --author=A.U.Thor -Spickaxe >foos.txt
> 
> and working from the text file foos.txt at least would not contaminate any
> ref namespace and you do not have to clean them after you are done.

Which works just as well, and is way more flexible. You have to be a little more proficient in using the shell, but that is at least a general skill which transfers to many other programs.

-Peff
Previous: Junio C Hamano
Message 5 of 5 in “Do we have a convenient way to refer to a specific commit in an already filtered rev-list?”
  1. Tzu-Jung LeeSep 24, 2011
  2. Jeff KingSep 27, 2011
  3. Tzu-Jung LeeOct 3, 2011
  4. Junio C HamanoOct 3, 2011
  5. Jeff KingOct 4, 2011

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.