{"thread":{"id":"15993","subject":"git command to read","startedAt":"2008-10-21T11:21:09Z","lastAt":"2008-10-21T12:06:35Z","messageCount":4,"participants":["Paul Mackerras","Jeff King","Alexander Gavrilov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"93593","messageId":"18685.47909.354146.487700@cargo.ozlabs.ibm.com","threadId":"15993","inReplyTo":null,"subject":"git command to read","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-10-21T11:21:09Z","receivedAt":"2008-10-21T11:21:09Z","isPatch":false,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Junio,\n\nIs there a command in git at the moment that will read commit IDs on\nstandard input and print the contents of each commit on standard\noutput (without waiting for EOF on stdin)?\n\nI tried git rev-list --stdin --no-walk --header, but it seems to\ncollect all the IDs from stdin and eliminate duplicates before\noutputting anything, which is not what I want.  What I want is a\nprocess that I can run from gitk where I can write IDs to its stdin\nwhenever gitk needs to know the contents of some commits, and know\nthat those contents will be turning up on the pipe from its stdout in\na timely fashion, without having to start a new process each time.  Is\nthere a way to do that currently?\n\nThe reason I want this is to reduce gitk's memory usage.  At present\nit reads all the commits into memory, which takes about 160MB on the\ncurrent kernel tree just to store the contents of all the commits\n(since Tcl stores strings internally as 2 bytes/character).  Instead I\nplan to make gitk keep a cache of commits and read in commits as\nneeded from an external process.  When doing a search, we may need to\nread in nearly all the commits, and we'll need to do it quickly.\n\nThanks,\nPaul.\n"},{"id":"93594","messageId":"20081021112521.GC17363@coredump.intra.peff.net","threadId":"15993","inReplyTo":"18685.47909.354146.487700@cargo.ozlabs.ibm.com","subject":"Re: git command to read","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-10-21T11:25:22Z","receivedAt":"2008-10-21T11:25:22Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Oct 21, 2008 at 10:21:09PM +1100, Paul Mackerras wrote:\n\n> Is there a command in git at the moment that will read commit IDs on\n> standard input and print the contents of each commit on standard\n> output (without waiting for EOF on stdin)?\n\nHow about:\n\n  git cat-file --batch\n\n?\n\nUnfortunately it just dumps the raw commit information instead of\nallowing the usual formatting, but perhaps that is sufficient (you asked\nfor \"contents\").\n\n-Peff\n"},{"id":"93599","messageId":"18685.49368.557513.727997@cargo.ozlabs.ibm.com","threadId":"15993","inReplyTo":"20081021112521.GC17363@coredump.intra.peff.net","subject":"Re: git command to read","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-10-21T11:45:28Z","receivedAt":"2008-10-21T11:45:28Z","isPatch":false,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Jeff King writes:\n\n> On Tue, Oct 21, 2008 at 10:21:09PM +1100, Paul Mackerras wrote:\n> \n> > Is there a command in git at the moment that will read commit IDs on\n> > standard input and print the contents of each commit on standard\n> > output (without waiting for EOF on stdin)?\n> \n> How about:\n> \n>   git cat-file --batch\n> \n> ?\n> \n> Unfortunately it just dumps the raw commit information instead of\n> allowing the usual formatting, but perhaps that is sufficient (you asked\n> for \"contents\").\n\nAh, thank you, that looks like just what I want. :)\n\nPaul.\n"},{"id":"93601","messageId":"bb6f213e0810210506u51cb83d4p718b793b3e9f7fca@mail.gmail.com","threadId":"15993","inReplyTo":"18685.49368.557513.727997@cargo.ozlabs.ibm.com","subject":"Re: git command to read","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-10-21T12:06:35Z","receivedAt":"2008-10-21T12:06:35Z","isPatch":false,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"On Tue, Oct 21, 2008 at 3:45 PM, Paul Mackerras <paulus@samba.org> wrote:\n> Jeff King writes:\n>\n>> On Tue, Oct 21, 2008 at 10:21:09PM +1100, Paul Mackerras wrote:\n>>\n>> > Is there a command in git at the moment that will read commit IDs on\n>> > standard input and print the contents of each commit on standard\n>> > output (without waiting for EOF on stdin)?\n>>\n>> How about:\n>>\n>>   git cat-file --batch\n>>\n>> ?\n>>\n>> Unfortunately it just dumps the raw commit information instead of\n>> allowing the usual formatting, but perhaps that is sufficient (you asked\n>> for \"contents\").\n>\n> Ah, thank you, that looks like just what I want. :)\n\nSince cat-file does not perform any encoding conversion, you'll have\nto process the encoding headers manually though.\n\nAlexander\n"}]}