git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* names using git config
@ 2009-06-24 16:58 Ryan
  2009-06-24 17:06 ` Matthieu Moy
  0 siblings, 1 reply; 6+ messages in thread
From: Ryan @ 2009-06-24 16:58 UTC (permalink / raw
  To: git

How do i select a Name which ends in a dot something like Ryan W.
Philips in Git using  git config user.name

Because when i do that "Ryan W. Philips" It just comes and Ryan W
Philips in git log when i add a commit.


Thanks,
Ryan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: names using git config
  2009-06-24 16:58 names using git config Ryan
@ 2009-06-24 17:06 ` Matthieu Moy
  2009-06-25  4:46   ` Ryan
  0 siblings, 1 reply; 6+ messages in thread
From: Matthieu Moy @ 2009-06-24 17:06 UTC (permalink / raw
  To: Ryan; +Cc: git

Ryan <ryanphilips19@googlemail.com> writes:

> How do i select a Name which ends in a dot something like Ryan W.
> Philips in Git using  git config user.name
>
> Because when i do that "Ryan W. Philips" It just comes and Ryan W
> Philips in git log when i add a commit.

Can't reproduce here:

$ mkdir git
$ cd git/
$ git init
Initialized empty Git repository in /tmp/git/.git/
$ git config user.name 'Matthieu M. Moy'
$ cat .git/config 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[user]
        name = Matthieu M. Moy
$ touch foo; git add foo
$ git commit -m "foo"
[master (root-commit) 6814174] foo
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 foo
$ git log
commit 681417491423260ad13c3fb59c28fc96a68bf4f9
Author: Matthieu M. Moy <Matthieu.Moy@imag.fr>
Date:   Wed Jun 24 19:05:43 2009 +0200

    foo
$ git version
git version 1.6.3.rc1.35.gabb3a
$ 

-- 
Matthieu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: names using git config
  2009-06-24 17:06 ` Matthieu Moy
@ 2009-06-25  4:46   ` Ryan
  2009-06-25  5:11     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Ryan @ 2009-06-25  4:46 UTC (permalink / raw
  To: Matthieu Moy; +Cc: git

Hi,
  Thank you for your response.

1) git config user.name 'Matthieu M. Moy' Works
2) git config user.name 'Matthieu M.'  does not


Probably, Name cannot end in a '.' <dot>. in git config user.name


Regards,
Ryan W.


On Wed, Jun 24, 2009 at 10:36 PM, Matthieu Moy<Matthieu.Moy@imag.fr> wrote:
> Ryan <ryanphilips19@googlemail.com> writes:
>
>> How do i select a Name which ends in a dot something like Ryan W.
>> Philips in Git using  git config user.name
>>
>> Because when i do that "Ryan W. Philips" It just comes and Ryan W
>> Philips in git log when i add a commit.
>
> Can't reproduce here:
>
> $ mkdir git
> $ cd git/
> $ git init
> Initialized empty Git repository in /tmp/git/.git/
> $ git config user.name 'Matthieu M. Moy'
> $ cat .git/config
> [core]
>        repositoryformatversion = 0
>        filemode = true
>        bare = false
>        logallrefupdates = true
> [user]
>        name = Matthieu M. Moy
> $ touch foo; git add foo
> $ git commit -m "foo"
> [master (root-commit) 6814174] foo
>  0 files changed, 0 insertions(+), 0 deletions(-)
>  create mode 100644 foo
> $ git log
> commit 681417491423260ad13c3fb59c28fc96a68bf4f9
> Author: Matthieu M. Moy <Matthieu.Moy@imag.fr>
> Date:   Wed Jun 24 19:05:43 2009 +0200
>
>    foo
> $ git version
> git version 1.6.3.rc1.35.gabb3a
> $
>
> --
> Matthieu
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: names using git config
  2009-06-25  4:46   ` Ryan
@ 2009-06-25  5:11     ` Junio C Hamano
  2009-06-25 10:09       ` Ryan
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2009-06-25  5:11 UTC (permalink / raw
  To: Ryan; +Cc: Matthieu Moy, git

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.

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: names using git config
  2009-06-25  5:11     ` Junio C Hamano
@ 2009-06-25 10:09       ` Ryan
  2009-06-25 18:46         ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Ryan @ 2009-06-25 10:09 UTC (permalink / raw
  To: Junio C Hamano; +Cc: Matthieu Moy, git

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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: names using git config
  2009-06-25 10:09       ` Ryan
@ 2009-06-25 18:46         ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2009-06-25 18:46 UTC (permalink / raw
  To: Ryan; +Cc: Matthieu Moy, git

Ryan <ryanphilips19@googlemail.com> writes:

> 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?

Sorry if I was unclear.  I wasn't suggesting anything in particular to
you.  The only concrete thing addressed to you in my message was the
answer "That is correct" and all the remainder of my message, including
the patch, was primarily meant as illustration for other git developers to
think about.

I do not think this matters that much in practice, as long as you are
submitting patches via e-mail, the usual method for leaf-level developers.
The maintainers apply your patches under the name your e-mail's From:
header carries, not your user.name.

If you apply the patch to your copy of git, your "git log" output will
start showing otherwise forbidden names that have leading or trailing dots
(and other letters like semicolons) because your modified copy of "git
commit" will allow them, and I think "git commit -s" also will pass the
trailing dots intact, but that is about the extent of the damage.  Without
applying the patch, you will perhaps see your "Signed-off-by: Foo M
<foo.m@example.com>" line without the trailing dots after the name, but
that is something you can easily modify in your MUA when you are sending
the e-mail out.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-25 18:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-06-25 18:46         ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).