Re: 'git show' with multiple revisions

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: 'git show' with multiple revisions

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:04:34

Ed Avis [off-list ref] writes:
Jeff King <peff <at> peff.net> writes:
quoted
I think you want `git cat-file`:

 {
echo REV1:FILE
echo REV2:FILE
 } |
 git cat-file --batch

This prints a header line for each output object which contains the size
of the object (so a parser reads a header line, then N bytes, then a
header line, N bytes, and so on).
This looks like what I want but the object ids printed appear to be the id
of the file in a given revision - not the id of the revision itself.
So the ids in the output are not the same as the ones in the input.
Actually you are asking for REV1:FILE and REV2:FILE, and you are
getting these object IDs in the output (you are not asking for REV1
or REV2 henace you will not see these commit object IDs).

"cat-file --batch" will give you the objects in the order you ask.
I _think_ you can even do that interactively (i.e. you spawn the
process, you feed one object name to its input, you consume its
output by reading the header and then given number of bytes, and
then you feed the next object name to its input, and so on) without
deadlocking yourself.

Re: 'git show' with multiple revisions

From: Ed Avis <hidden>
Date: 2016-06-15 23:04:34

Junio C Hamano <gitster <at> pobox.com> writes:
"cat-file --batch" will give you the objects in the order you ask.
Thanks, that makes it easy to deal with.  In fact, I might prefer to use
git cat-file --batch-check and then use some other library to fetch the blob
contents.

-- 
Ed Avis [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help