Web lists-archives.com

Re: [PATCH] diff: add support for reading files literally with --no-index




On Thu, Dec 20, 2018 at 1:26 AM brian m. carlson
<sandals@xxxxxxxxxxxxxxxxxxxx> wrote:
> @@ -5159,6 +5159,8 @@ int diff_opt_parse(struct diff_options *options,
>                 options->flags.funccontext = 1;
>         else if (!strcmp(arg, "--no-function-context"))
>                 options->flags.funccontext = 0;
> +       else if (!strcmp(arg, "--literally"))
> +               options->flags.read_literally = 1;

You probably want to check in diff_setup_done() that if
flags.read_literally is set but flags.no_index is not, then abandon
ship and die() because --literally is not used with --no-index. Even
when --no-index is implicit, flags.no_index should be set.

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.
-- 
Duy