From: John Cai <johncai86@gmail.com>
To: Christian Couder <christian.couder@gmail.com>
Cc: John Cai via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v4] attr: teach "--attr-source=<tree>" global option to "git"
Date: Wed, 3 May 2023 14:40:50 -0400 [thread overview]
Message-ID: <20230503184050.wpouoe533rg2uyyw@pop-os> (raw)
In-Reply-To: <CAP8UFD00omU=HiGQyaNx=ZbuH79rCv-eHkCuQ1sf5xv9zu4ffg@mail.gmail.com>
Hi Christian,
On 23/05/03 05:10PM, Christian Couder wrote:
> On Sun, Apr 30, 2023 at 4:39 AM John Cai via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>
> > diff --git a/Documentation/git.txt b/Documentation/git.txt
> > index 74973d3cc40..b8f4f604707 100644
> > --- a/Documentation/git.txt
> > +++ b/Documentation/git.txt
> > @@ -212,6 +212,11 @@ If you just want to run git as if it was started in `<path>` then use
> > nohelpers (exclude helper commands), alias and config
> > (retrieve command list from config variable completion.commands)
> >
> > +--attr-source=<tree-ish>::
> > + Read gitattributes from <tree-ish> instead of the worktree. See
> > + linkgit:gitattributes[5]. This is equivalent to setting the
> > + `GIT_ATTR_SOURCE` environment variable.
>
> As you talk about GIT_ATTR_SOURCE, I wonder if this variable should
> also be documented in the "Environment Variables" section of this
> Documentation/git.txt doc.
>
> > diff --git a/environment.h b/environment.h
> > index a63f0c6a24f..758927a689c 100644
> > --- a/environment.h
> > +++ b/environment.h
> > @@ -55,6 +55,7 @@ const char *getenv_safe(struct strvec *argv, const char *name);
> > #define GIT_QUARANTINE_ENVIRONMENT "GIT_QUARANTINE_PATH"
> > #define GIT_OPTIONAL_LOCKS_ENVIRONMENT "GIT_OPTIONAL_LOCKS"
> > #define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR"
> > +#define GIT_ATTR_SOURCE "GIT_ATTR_SOURCE"
>
> To be similar with the definitions that are just above, I think it
> actually should be:
>
> #define GIT_ATTR_SOURCE_ENVIRONMENT "GIT_ATTR_SOURCE"
>
> > @@ -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 prefix given for --attr-source\n" ));
>
> The example I sent was about '--super-prefix' so it made sense to say
> "no prefix given", but here it makes more sense to say something like
> "no attribute source given for --attr-source".
>
All good feedback. I'll update the branch with these changes.
> > + usage(git_usage_string);
> > + }
> > + setenv(GIT_ATTR_SOURCE, (*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, (*argv)[1], 1);
> > + if (envchanged)
> > + *envchanged = 1;
> > } else {
> > fprintf(stderr, _("unknown option: %s\n"), cmd);
> > usage(git_usage_string);
thanks
John
next prev parent reply other threads:[~2023-05-03 18:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-18 3:25 [PATCH] attr: teach "--attr-source=<tree>" global option to "git" John Cai via GitGitGadget
2023-03-27 17:02 ` [PATCH v2] " John Cai via GitGitGadget
2023-03-27 18:29 ` Junio C Hamano
2023-03-27 19:40 ` John Cai
2023-04-27 14:02 ` Christian Couder
2023-04-27 14:07 ` Christian Couder
2023-04-28 18:50 ` [PATCH v3] " John Cai via GitGitGadget
2023-04-28 20:22 ` Christian Couder
2023-04-30 2:22 ` John Cai
2023-04-30 2:39 ` [PATCH v4] " John Cai via GitGitGadget
2023-05-01 16:21 ` Junio C Hamano
2023-05-03 15:10 ` Christian Couder
2023-05-03 18:40 ` John Cai [this message]
2023-05-03 20:09 ` [PATCH v5] " John Cai via GitGitGadget
2023-05-04 9:50 ` Christian Couder
2023-05-06 4:15 ` [PATCH v6] " John Cai via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230503184050.wpouoe533rg2uyyw@pop-os \
--to=johncai86@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).