Re: [PATCH v9] ls-files: introduce "--format" option
- From
Jiang Xin <worldhello.net@gmail.com>
- Date
- Sep 8, 2022, 02:01 UTC
- Message-ID
- <CANYiYbFGSfg+iFV1ovhCSxW0YQSpemKUN-sS+F0BHee7KD5arA@mail.gmail.com>
- In-Reply-To
- <pull.1262.v9.git.1658558685407.gitgitgadget@gmail.com>
On Sat, Jul 23, 2022 at 2:54 PM ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 27 quoted lines
> diff --git a/builtin/ls-files.c b/builtin/ls-files.c
> index e791b65e7e9..779dc18e59d 100644
> --- a/builtin/ls-files.c
> +++ b/builtin/ls-files.c
> @@ -222,6 +234,73 @@ static void show_submodule(struct repository *superproject,
> repo_clear(&subrepo);
> }
>
> +struct show_index_data {
> + const char *pathname;
> + struct index_state *istate;
> + const struct cache_entry *ce;
> +};
> +
> +static size_t expand_show_index(struct strbuf *sb, const char *start,
> + void *context)
> +{
> + struct show_index_data *data = context;
> + const char *end;
> + const char *p;
> + size_t len = strbuf_expand_literal_cb(sb, start, NULL);
> + struct stat st;
> +
> + if (len)
> + return len;
> + if (*start != '(')
> + die(_("bad ls-files format: element '%s' "Good, the last space acts as a separator between two lines.
Show 5 quoted lines
> + "does not start with '('"), start);
> +
> + end = strchr(start + 1, ')');
> + if (!end)
> + die(_("bad ls-files format: element '%s'"Missing the last space to seperate two lines, and this leads to wrong l10n message. See:
https://github.com/git-l10n/pot-changes/blob/pot/main/2022-08-03.diff#L70
-- Jiang Xin