git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git command to read
@ 2008-10-21 11:21 Paul Mackerras
  2008-10-21 11:25 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Mackerras @ 2008-10-21 11:21 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git

Junio,

Is there a command in git at the moment that will read commit IDs on
standard input and print the contents of each commit on standard
output (without waiting for EOF on stdin)?

I tried git rev-list --stdin --no-walk --header, but it seems to
collect all the IDs from stdin and eliminate duplicates before
outputting anything, which is not what I want.  What I want is a
process that I can run from gitk where I can write IDs to its stdin
whenever gitk needs to know the contents of some commits, and know
that those contents will be turning up on the pipe from its stdout in
a timely fashion, without having to start a new process each time.  Is
there a way to do that currently?

The reason I want this is to reduce gitk's memory usage.  At present
it reads all the commits into memory, which takes about 160MB on the
current kernel tree just to store the contents of all the commits
(since Tcl stores strings internally as 2 bytes/character).  Instead I
plan to make gitk keep a cache of commits and read in commits as
needed from an external process.  When doing a search, we may need to
read in nearly all the commits, and we'll need to do it quickly.

Thanks,
Paul.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git command to read
  2008-10-21 11:21 git command to read Paul Mackerras
@ 2008-10-21 11:25 ` Jeff King
  2008-10-21 11:45   ` Paul Mackerras
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2008-10-21 11:25 UTC (permalink / raw
  To: Paul Mackerras; +Cc: Junio C Hamano, git

On Tue, Oct 21, 2008 at 10:21:09PM +1100, Paul Mackerras wrote:

> Is there a command in git at the moment that will read commit IDs on
> standard input and print the contents of each commit on standard
> output (without waiting for EOF on stdin)?

How about:

  git cat-file --batch

?

Unfortunately it just dumps the raw commit information instead of
allowing the usual formatting, but perhaps that is sufficient (you asked
for "contents").

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git command to read
  2008-10-21 11:25 ` Jeff King
@ 2008-10-21 11:45   ` Paul Mackerras
  2008-10-21 12:06     ` Alexander Gavrilov
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Mackerras @ 2008-10-21 11:45 UTC (permalink / raw
  To: Jeff King; +Cc: Junio C Hamano, git

Jeff King writes:

> On Tue, Oct 21, 2008 at 10:21:09PM +1100, Paul Mackerras wrote:
> 
> > Is there a command in git at the moment that will read commit IDs on
> > standard input and print the contents of each commit on standard
> > output (without waiting for EOF on stdin)?
> 
> How about:
> 
>   git cat-file --batch
> 
> ?
> 
> Unfortunately it just dumps the raw commit information instead of
> allowing the usual formatting, but perhaps that is sufficient (you asked
> for "contents").

Ah, thank you, that looks like just what I want. :)

Paul.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git command to read
  2008-10-21 11:45   ` Paul Mackerras
@ 2008-10-21 12:06     ` Alexander Gavrilov
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Gavrilov @ 2008-10-21 12:06 UTC (permalink / raw
  To: Paul Mackerras; +Cc: Jeff King, Junio C Hamano, git

On Tue, Oct 21, 2008 at 3:45 PM, Paul Mackerras <paulus@samba.org> wrote:
> Jeff King writes:
>
>> On Tue, Oct 21, 2008 at 10:21:09PM +1100, Paul Mackerras wrote:
>>
>> > Is there a command in git at the moment that will read commit IDs on
>> > standard input and print the contents of each commit on standard
>> > output (without waiting for EOF on stdin)?
>>
>> How about:
>>
>>   git cat-file --batch
>>
>> ?
>>
>> Unfortunately it just dumps the raw commit information instead of
>> allowing the usual formatting, but perhaps that is sufficient (you asked
>> for "contents").
>
> Ah, thank you, that looks like just what I want. :)

Since cat-file does not perform any encoding conversion, you'll have
to process the encoding headers manually though.

Alexander

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-21 12:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-21 11:21 git command to read Paul Mackerras
2008-10-21 11:25 ` Jeff King
2008-10-21 11:45   ` Paul Mackerras
2008-10-21 12:06     ` Alexander Gavrilov

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).