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

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:48:44

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help