Subject: Re: [PATCH v4] ls-files: introduce "--format" option

From: Junio C Hamano <[email-masked]>
Date: Mon, 27 Jun 2022 01:32:07 -0700

"ZheNing Hu via GitGitGadget" <[email-masked]> writes:

> Range-diff vs v3:
> ...
>       +test_done

I omitted 300 lines of range-diff, which is not exactly illuminating
in this case.  I wonder if there is a way to turn it off when it is
not helping automatically...

> +FIELD NAMES
> +-----------
> +Various values from structured fields can be used to interpolate
> +into the resulting output. For each outputting line, the following
> +names can be used:
> +
> +objectmode::
> +	The mode of the file which is recorded in the index.
> +objectname::
> +	The name of the file which is recorded in the index.
> +stage::
> +	The stage of the file which is recorded in the index.

> +eolinfo:index::
> +	The <eolinfo> of the file which is recorded in the index.
> +eolinfo:worktree::
> +	The <eolinfo> of the file which is recorded in the working tree.

These sound somewhat strange, as the above makes it sound as if we
are recording eolinfo for something (we never record eolinfo of
anything anywhere).

	eolinfo:index::
	eolinfo:worktree::
        	The <eolinfo> (see the description of the `--eol` option) of
                the contents in the index or in the worktree for the path

perhaps?  I dunno.

> +eolattr::
> +	The <eolattr> of the file which is recorded in the index.

Likewise, eolattr comes from the attribute subsystem and not
recorded in the index.  It is more like

	eolattr:
                The <eolattr> (see the description of the `--eol` option)
                that applies to the path.

Because attribute applies to the path, it applies equally to both
what is in the index and what is in the working tree.

> +path::
> +	The pathname of the file which is recorded in the index.

As ls-tree already uses %(path) for it, this is probably OK
(otherwise we would probably have called it %(pathname)).