git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 1, 2023, 16:21 UTC
Message-ID
<xmqqh6sw6mzr.fsf@gitster.g>
In-Reply-To
<pull.1470.v4.git.git.1682822352360.gitgitgadget@gmail.com>
"John Cai via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 35 quoted lines
> From: John Cai <johncai86@gmail.com>
>
> 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 <johncai86@gmail.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>     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.
Previous: John Cai via GitGitGadgetNext: Christian Couder
Message 11 of 16 in “attr: teach "--attr-source=<tree>" global option to "git"”
  1. attr: teach "--attr-source=<tree>" global option to "git"John Cai via GitGitGadget, Mar 18, 2023
  2. attr: teach "--attr-source=<tree>" global option to "git"John Cai via GitGitGadget, Mar 27, 2023
  3. Junio C HamanoMar 27, 2023
  4. John CaiMar 27, 2023
  5. Christian CouderApr 27, 2023
  6. Christian CouderApr 27, 2023
  7. attr: teach "--attr-source=<tree>" global option to "git"John Cai via GitGitGadget, Apr 28, 2023
  8. Christian CouderApr 28, 2023
  9. John CaiApr 30, 2023
  10. attr: teach "--attr-source=<tree>" global option to "git"John Cai via GitGitGadget, Apr 30, 2023
  11. Junio C HamanoMay 1, 2023
  12. Christian CouderMay 3, 2023
  13. John CaiMay 3, 2023
  14. attr: teach "--attr-source=<tree>" global option to "git"John Cai via GitGitGadget, May 3, 2023
  15. Christian CouderMay 4, 2023
  16. attr: teach "--attr-source=<tree>" global option to "git"John Cai via GitGitGadget, May 6, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.