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

rev-parse vs. rev-list --no-walk

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 1, 2010, 18:35 UTC
Message-ID
<4BDC7471.9030107@drmicha.warpmail.net>

In connection with an upcoming RFD patch, I noticed that rev-parse and rev-list --no-walk do very similar things (OK - I knew *that* already) in different ways. In particular, rev-list uses the ordinary setup_revision() which is used in many other places, whereas rev-parse does it's own thing.

rev-parse does a couple more things, of course, but why doesn't it use setup_revision() ? I just wanted to ask before trying to restructure things....

As it is we have the maintenance burden of keeping both rev option parsers in sync. And, in fact, they are not:

- setup_revision() (and thus rev-list) explicitly adds HEAD for "--all",
rev-parse does not
- setup_revision() outputs each sha1 only once, rev-parse possibly
multiple times (in case of coinciding heads/tags...)

Of course, rev-parse and rev-list --no-walk do actually very different things, as one can see from the results of "--tags" on both (partially answering my own question here). And that difference is intentional. So:

- Should setup_revision() really add HEAD on --all? (Probably yes.) In
this case I'd adjust the doc.
- Shouldn't rev-parse --all add HEAD as well?
- Is there any way to use setup_revision() without resolving tags to
commits etc. (and thus using it for rev-parse)?
Michael
Next: Junio C Hamano
Message 1 of 4 in “rev-parse vs. rev-list --no-walk”
  1. Michael J GruberMay 1, 2010
  2. Junio C HamanoMay 1, 2010
  3. Jay SoffianMay 3, 2010
  4. Michael J GruberMay 3, 2010

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.