Jeff King <p...@peff.net> writes:

>> If read-tree had pathspec support (i.e. "read these and only these
>> paths given from the command line into the index from a given
>> tree-ish"), that would have been the most natural place to extend
>> with "oh, by the way, instead of the command line, you can feed the
>> paths on the standard input".
>> 
>> But it doesn't have one.
>
> True. I'd have done something more like:
>
>   git ls-tree -r $paths | git update-index --index-info
>
> but there are some corner cases around deleting paths from the index.

Ah, I would think read-tree has the exact same issue, even if we
added pathspec support, around removal.

So it is more like

        (
                printf "0 0000000000000000000000000000000000000000\t%s\n" $paths
                git --literal-pathspecs ls-tree -r --ignore-missing $paths
        ) | git update-index --index-info

which does not look too bad, even though this

        printf "%s\n" $paths | git reset --stdin

does look shorter.

Reply via email to