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