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

Re: Why does diff --binary include content of files being deleted?

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 22, 2008, 04:15 UTC
Message-ID
<20080622041510.GE11793@spearce.org>
In-Reply-To
<20080622040536.GA10813@lifeintegrity.com>
Allan Wind <allan_wind@lifeintegrity.com> wrote:
Show 6 quoted lines
> On 2008-06-21T23:51:18-0400, Shawn O. Pearce wrote:
> > In order to apply the diff in reverse we need the old binary data
> > in the diff output.  So that's why its larger.
> 
> Makes sense, thanks.  In my use case (where I do not need the reverse 
> diff) this adds 500+ MB or 43159% overhead.

Well, then in that case you have to omit --binary I think, or use a filter script to strip out the binary data from the resulting patch.

> When I tried to apply the large diff my virtual private server with 512 
> MB of memory git apply ran out of memory and died.  Is there any way to 
> bound the memory usage of git apply?
If you submit patches for it.  ;-)

git-apply today is meant for applying small patches, like those that would typically be written by a developer hacking on open source software. It tries to be completely atomic; either the entire patch applies at once, or the entire patch rejects with no changes being made to the local directory. As such it applies everything in memory, and only writes out when we are sure the patch applies clean.

So no, there isn't a way to make git-apply use less memory.
-- 
Shawn.
Previous: Allan Wind
Message 4 of 4 in “Why does diff --binary include content of files being deleted?”
  1. Allan WindJun 22, 2008
  2. Shawn O. PearceJun 22, 2008
  3. Allan WindJun 22, 2008
  4. Shawn O. PearceJun 22, 2008

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.