public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jeff King <peff@peff•net>
To: Ed Avis <eda@waniasset•com>
Cc: git@vger•kernel.org
Subject: Re: 'git show' with multiple revisions
Date: Tue, 28 Apr 2015 22:04:52 -0400	[thread overview]
Message-ID: <20150429020452.GA873@peff.net> (raw)
In-Reply-To: <loom.20150428T120412-982@post.gmane.org>

On Tue, Apr 28, 2015 at 10:10:52AM +0000, Ed Avis wrote:

> Could 'git show' sprout an option to get multiple things programmatically
> so that they can be separated out again?  One way would be to quote or escape
> the contents somehow so that the result can be parsed:
> 
>     % git show --porcelain REV1:FILE REV2:FILE
>
> [...]
>
> Note that here I am only getting the file content, not log messages or any of
> the other things which 'git show' can produce.  So perhaps what I really want
> is some kind of 'git cat'.  Or is there another more appropriate tool?

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).

-Peff

  reply	other threads:[~2015-04-29  2:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 10:10 'git show' with multiple revisions Ed Avis
2015-04-29  2:04 ` Jeff King [this message]
2015-04-29 15:47   ` Ed Avis
2015-04-29 15:53     ` Jeff King
2015-04-29 15:53     ` Junio C Hamano
2015-04-29 16:01       ` Ed Avis
2015-04-29 16:08         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150429020452.GA873@peff.net \
    --to=peff@peff$(echo .)net \
    --cc=eda@waniasset$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox