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

Re: Making custom git-remove-tree command

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Feb 4, 2010, 16:43 UTC
Message-ID
<4B6AF94F.6070604@viscovery.net>
In-Reply-To
<87tytxhsgc.fsf@mithlond.arda>
Teemu Likonen schrieb:
Show 14 quoted lines
> * 2010-02-04 10:55 (+0100), Johannes Sixt wrote:
> 
>> I think you should be able to reduce all of this to just
>>
>> git read-tree --index-output=/tmp/empty.index -m -u \
>> 	4b825dc642cb6eb9a060e54bf8d69288fbee4904 # empty tree
>> rm -f /tmp/empty.index
>>
>> (with the usual caveats about temporary files).
> 
> Thanks, it works. It's also _much_ faster than my "git ls-tree" with
> shell loop thing. It prints ugly error, though:
> 
>     fatal: unable to write new index file
Then put the temporary index into your git-dir:
   gitdir=$(git rev-parse --git-dir)
   git read-tree --index-ouput="$gitdir/tmpindex" ...
   rm -f "$gitdir/tmpindex"

The purpose of this temporary index is only that your real index is not cleared. If you don't mind that your index is purged as well, then you can just drop the --index-output parameter.

-- Hannes
Previous: Teemu Likonen
Message 4 of 4 in “Making custom git-remove-tree command”
  1. Teemu LikonenFeb 4, 2010
  2. Johannes SixtFeb 4, 2010
  3. Teemu LikonenFeb 4, 2010
  4. Johannes SixtFeb 4, 2010

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.