From: Ryan <ryanphilips19@googlemail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>, git@vger.kernel.org
Subject: Re: names using git config
Date: Thu, 25 Jun 2009 15:39:11 +0530 [thread overview]
Message-ID: <376636be0906250309h6eb99296r4b81cf22985b690a@mail.gmail.com> (raw)
In-Reply-To: <7veit8kidz.fsf@alter.siamese.dyndns.org>
On Thu, Jun 25, 2009 at 10:41 AM, Junio C Hamano<gitster@pobox.com> wrote:
> Ryan <ryanphilips19@googlemail.com> writes:
>
>> Hi,
>> Thank you for your response.
>>
>> 1) git config user.name 'Matthieu M. Moy' Works
>> 2) git config user.name 'Matthieu M.' does not
>>
>> Name cannot end in a '.' <dot>. in git config user.name
>
> That is correct, but I think we are a bit too strict in sanitizing names.
> The code is ident.c::copy() whose intent was to sanitize useless runs of
> commas we slurp from GECOS field, but the sanitization is done also for
> anything specified by the end user.
>
What are you suggesting me to do? Apply the below patch.
I may want to submit patches to the linux kernel. Is this okay? Or
will this (below patch)
on machine will later at some point of time cause trouble to people
applying the patches.
Does git am or git apply check if name ends in a "." and do something?
Thank you,
Ryan W.
> This patch loosens it, but I think it goes too far, in that it does not
> stop you from feeding total nonsense with GIT_AUTHOR_NAME environment and
> user.name configuration.
>
> ident.c | 5 ++---
> t/t1300-repo-config.sh | 12 ++++++++++++
> 2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/ident.c b/ident.c
> index 99f1c85..07ec81d 100644
> --- a/ident.c
> +++ b/ident.c
> @@ -212,8 +212,7 @@ const char *fmt_ident(const char *name, const char *email,
> pw = getpwuid(getuid());
> if (!pw)
> die("You don't exist. Go away!");
> - strlcpy(git_default_name, pw->pw_name,
> - sizeof(git_default_name));
> + copy(git_default_name, sizeof(git_default_name), 0, pw->pw_name);
> name = git_default_name;
> }
>
> @@ -221,7 +220,7 @@ const char *fmt_ident(const char *name, const char *email,
> if (!name_addr_only && date_str)
> parse_date(date_str, date, sizeof(date));
>
> - i = copy(buffer, sizeof(buffer), 0, name);
> + i = add_raw(buffer, sizeof(buffer), 0, name);
> i = add_raw(buffer, sizeof(buffer), i, " <");
> i = copy(buffer, sizeof(buffer), i, email);
> if (!name_addr_only) {
> diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
> index 43ea283..c1a913e 100755
> --- a/t/t1300-repo-config.sh
> +++ b/t/t1300-repo-config.sh
> @@ -758,4 +758,16 @@ test_expect_success 'check split_cmdline return' "
> test_must_fail git merge master
> "
>
> +test_expect_success 'name ending in dot' '
> + foobar="Foo Bar."
> + git config user.name "$foobar" &&
> + git config user.email "foo.bar@example.com" &&
> + test "$(git config user.name)" = "$foobar" &&
> + (
> + unset GIT_AUTHOR_NAME
> + ident=$(git var GIT_AUTHOR_IDENT | sed -e "s/ *<.*//") &&
> + test "$ident" = "$foobar"
> + )
> +'
> +
> test_done
>
next prev parent reply other threads:[~2009-06-25 10:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-24 16:58 names using git config Ryan
2009-06-24 17:06 ` Matthieu Moy
2009-06-25 4:46 ` Ryan
2009-06-25 5:11 ` Junio C Hamano
2009-06-25 10:09 ` Ryan [this message]
2009-06-25 18:46 ` Junio C Hamano
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=376636be0906250309h6eb99296r4b81cf22985b690a@mail.gmail.com \
--to=ryanphilips19@googlemail.com \
--cc=Matthieu.Moy@imag.fr \
--cc=git@vger.kernel.org \
--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 NNTP newsgroup(s).