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

Re: Using git-update-index to add existing tree objects at other paths

From
Chris Torek <chris.torek@gmail.com>
Date
Oct 4, 2022, 15:10 UTC
Message-ID
<CAPx1GvfsRipG0qgDmMMoU+WCWCEyr4ayJteYWAy+EoJOoaNQXg@mail.gmail.com>
In-Reply-To
<87o7ur1wi9.fsf@gmail.com>
On Tue, Oct 4, 2022 at 7:43 AM Sean Allred <allred.sean@gmail.com> wrote:
> ... but the following does not work:
>
>     $ cat | git update-index --index-info
>     040000 tree TREEID1 PATH1

The index is not designed to hold tree objects (at least not at this level), and update-index should be fed only the full path names of files, symbolic links (mode 120000), or gitlinks (mode 160000).

Whether it's reasonable to ask for the update-index command to understand that `040000 tree <treeid> <path>` means to insert all the files *within* the given (existing) tree object, at the implied constructed paths, I'll leave as an open topic here. :-) But if you were to do this manually yourself, it should work.

Chris
Previous: Sean AllredNext: Junio C Hamano
Message 2 of 4 in “Using git-update-index to add existing tree objects at other paths”
  1. Sean AllredOct 4, 2022
  2. Chris TorekOct 4, 2022
  3. Junio C HamanoOct 5, 2022
  4. Phillip WoodOct 4, 2022

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.