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

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

From
Christian Couder <christian.couder@gmail.com>
Date
May 4, 2023, 09:50 UTC
Message-ID
<CAP8UFD1AuFWWC=iAe0duhpSsw9HnA-tcpV2F3NGT+089aY60Ow@mail.gmail.com>
In-Reply-To
<pull.1470.v5.git.git.1683144574158.gitgitgadget@gmail.com>

On Wed, May 3, 2023 at 10:09 PM John Cai via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 17 quoted lines
> @@ -314,6 +315,21 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
>                         } else {
>                                 exit(list_cmds(cmd));
>                         }
> +               } else if (!strcmp(cmd, "--attr-source")) {
> +                       if (*argc < 2) {
> +                               fprintf(stderr, _("no attribute source given for --attr-source\n" ));
> +                               usage(git_usage_string);
> +                       }
> +                       setenv(GIT_ATTR_SOURCE_ENVIRONMENT, (*argv)[1], 1);
> +                       if (envchanged)
> +                               *envchanged = 1;
> +                       (*argv)++;
> +                       (*argc)--;
> +               } else if (skip_prefix(cmd, "--attr-source=", &cmd)) {
> +                       set_git_attr_source(cmd);
> +                       setenv(GIT_ATTR_SOURCE_ENVIRONMENT, (*argv)[1], 1);

It seems to me that for other options "cmd" is used here instead of "(*argv)[1]" as the second argument to setenv(), for example:

setenv(GIT_SUPER_PREFIX_ENVIRONMENT, cmd, 1);
Show 5 quoted lines
> +                       if (envchanged)
> +                               *envchanged = 1;
>                 } else {
>                         fprintf(stderr, _("unknown option: %s\n"), cmd);
>                         usage(git_usage_string);
Previous: John Cai via GitGitGadgetNext: John Cai via GitGitGadget
Message 15 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.