git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Allow saving an object from a pipe

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Dec 12, 2005, 17:12 UTC
Message-ID
<Pine.LNX.4.64.0512121210010.25300@iabervon.org>
In-Reply-To
<7v64pwuyny.fsf@assigned-by-dhcp.cox.net>
On Sat, 10 Dec 2005, Junio C Hamano wrote:
Show 14 quoted lines
> Daniel Barkalow <barkalow@iabervon.org> writes:
> 
> > In order to support getting data into git with scripts, this adds a
> > --stdin option to git-hash-object, which will make it read from stdin.
> 
> Thanks, will apply.
> 
> To be honest, though, I am still debating myself about the merit
> of not having to have a temporary file.  Because we need the
> size of the blob available before starting to hash (i.e. we
> cannot say "atend"), index_pipe ends up keeping the whole blob
> data in memory, which is not much better than the caller storing
> it in a temporary file and driving the normal hash-object from
> the command line anyway.

It's not much better for efficiency, but it's a whole lot easier to write the script without having to worry about a temporary file, what could happen to it while you're trying to use it, and making sure it gets cleaned up afterwards. It can also save on disk writes, depending on where you put it and how the system is configured.

	-Daniel
*This .sig left intentionally blank*
Previous: Junio C Hamano
Message 3 of 3 in “Allow saving an object from a pipe”
  1. Allow saving an object from a pipeDaniel Barkalow, Dec 10, 2005
  2. Junio C HamanoDec 11, 2005
  3. Daniel BarkalowDec 12, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.