Subject: Re: [PATCH v4] attr: teach "--attr-source=<tree>" global option to "git"

From: Junio C Hamano <[email-masked]>
Date: Mon, 01 May 2023 09:21:44 -0700

"John Cai via GitGitGadget" <[email-masked]> writes:

> From: John Cai <[email-masked]>
>
> Earlier, 47cfc9bd (attr: add flag `--source` to work with tree-ish,
> 2023-01-14) taught "git check-attr" the "--source=<tree>" option to
> allow it to read attribute files from a tree-ish, but did so only
> for the command.  Just like "check-attr" users wanted a way to use
> attributes from a tree-ish and not from the working tree files,
> users of other commands (like "git diff") would benefit from the
> same.
>
> Undo most of the UI change the commit made, while keeping the
> internal logic to read attributes from a given tree-ish. Expose the
> internal logic via a new "--attr-source=<tree>" command line option
> given to "git", so that it can be used with any git command that
> runs as part of the main git process.
>
> Additionally, add an environment variable GIT_ATTR_SOURCE that is set
> when --attr-source is passed in, so that subprocesses use the same value
> for the attributes source tree.
>
> Signed-off-by: John Cai <[email-masked]>
> Signed-off-by: Junio C Hamano <[email-masked]>
> ---
>     attr: teach "--attr-source=" global option to "git"
>     
>     [1] aimed to allow gitattributes to be read from bare repositories when
>     running git-diff(1). Through discussion, a more general solution emerged
>     (represented by this patch), which allows the attribute machinery to
>     read attributes from a source passed in through a git flag.
>     
>     Changes since v3:
>     
>      * fixed documentation link
>      * simplified error message handling when --attr-source or
>        GIT_ATTR_SOURCE is bad

Looking good.  Will queue; let's merge it down to 'next' soonish.

Thanks.