Re: [PATCH] diff: add support for reading files literally with --no-index
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Dec 20, 2018, 17:23 UTC
- Message-ID
- <CACsJy8AFwSgL-YAc2YU2XfqKFkXf-W+2V7tMy3ZOYvm_zhv5Bg@mail.gmail.com>
- In-Reply-To
- <20181220171725.GB6684@sigill.intra.peff.net>
On Thu, Dec 20, 2018 at 6:18 PM Jeff King <peff@peff.net> wrote:
Show 9 quoted lines
> > I wonder if --follow-symlinks would be a good alternative for this > > (then if the final destination is unmmapable then we just read the > > file whole in memory without the user asking, so it will work with > > pipes). --follow-symlinks then could be made work with non-"no-index" > > case too. But --literally is also ok. > > It's more than symlinks, though. Reading from a named pipe, we'd want to > see the actual contents with --literally (and not "oops, I don't know > how to represent a named pipe").
Yes, but I think at least --no-index it makes sense to just fall back to read() if we can't mmap(). mmap is more of an optimization than a requirement. There's no loss going from "oops I don't know how to represent it" to "here's the content from whatever what that device is". Symlinks are different because we have two possible representations and the user should choose.
-- Duy