# [PATCH] Disallow empty GIT_AUTHOR_NAME or GIT_COMMITTER_NAME

3 messages from 2007-07-06 to 2007-07-09. Participants: Brandon Casey, Junio C Hamano.
Thread: https://gitlist.dev/t/8902

## Brandon Casey, 2007-07-06 17:50

Subject: [PATCH] Disallow empty GIT_AUTHOR_NAME or GIT_COMMITTER_NAME
Message-ID: <468E80D3.5060706@nrlssc.navy.mil>
URL: https://gitlist.dev/e/468E80D3.5060706%40nrlssc.navy.mil

```
Attempt normal methods for determining user name if
GIT_AUTHOR_NAME or GIT_COMMITTER_NAME is set to the empty
string. Then fall back to using the user login name.

Previously, if these environment variables were set to the
empty string, a message would be printed complaining about
missing gecos information. In this case the gecos information
was never checked.

This still allows an empty GIT_AUTHOR_EMAIL or GIT_COMMITTER_EMAIL.
Possibly someone would want to use these variables to disable
the respective email address string?

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---


Trivial one-liner. I made this patch against master, not
on top of my previous patch. I assume this is the preferred way.

In case anyone is interested, I am submitting this using thunderbird
by the following method.

Set thunderbird config variables according to SubmittingPatches doc.
i.e.:
   Compose messages in HTML format
   mailnews.send_plaintext_flowed  => false
   mailnews.wraplength             => 0

Then I send the patch to myself using git-format-patch and then
git-send-email. These two format the patch appropriately for
submission and allow me to set the message-id.

Then I select the message, right-click and choose "Edit As New...",
edit, select the recipients, and send. I also now have a record of
the sent message which I would not have if I used only git-send-email.

-brandon


 ident.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ident.c b/ident.c
index 3d49608..6932ccf 100644
--- a/ident.c
+++ b/ident.c
@@ -193,7 +193,7 @@ const char *fmt_ident(const char *name, const char *email,
 	int i;
 
 	setup_ident();
-	if (!name)
+	if (!name || !*name)
 		name = git_default_name;
 	if (!email)
 		email = git_default_email;
-- 
1.5.3.rc0.30.g114f-dirty

```

## Junio C Hamano, 2007-07-07 05:45

Subject: Re: [PATCH] Disallow empty GIT_AUTHOR_NAME or GIT_COMMITTER_NAME
Message-ID: <7vlkdsdaxo.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vlkdsdaxo.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <468E80D3.5060706@nrlssc.navy.mil>

```
Brandon Casey <casey@nrlssc.navy.mil> writes:

Brandon Casey <casey@nrlssc.navy.mil> writes:

> Attempt normal methods for determining user name if
> GIT_AUTHOR_NAME or GIT_COMMITTER_NAME is set to the empty
> string. Then fall back to using the user login name.
>
> Previously, if these environment variables were set to the
> empty string, a message would be printed complaining about
> missing gecos information. In this case the gecos information
> was never checked.
>
> This still allows an empty GIT_AUTHOR_EMAIL or GIT_COMMITTER_EMAIL.
> Possibly someone would want to use these variables to disable
> the respective email address string?
>
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>

Thanks.  But this makes me wonder why you do not do the same
check for !*email

> Then I send the patch to myself using git-format-patch and then
> git-send-email. These two format the patch appropriately for
> submission and allow me to set the message-id.
>
> Then I select the message, right-click and choose "Edit As New...",
> edit, select the recipients, and send. I also now have a record of
> the sent message which I would not have if I used only git-send-email.

I would just add myself to --bcc when running send-email; much
simpler ;-). 

>  ident.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/ident.c b/ident.c
> index 3d49608..6932ccf 100644
> --- a/ident.c
> +++ b/ident.c
> @@ -193,7 +193,7 @@ const char *fmt_ident(const char *name, const char *email,
>  	int i;
>  
>  	setup_ident();
> -	if (!name)
> +	if (!name || !*name)
>  		name = git_default_name;
>  	if (!email)
>  		email = git_default_email;
> -- 
> 1.5.3.rc0.30.g114f-dirty

```

## Brandon Casey, 2007-07-09 16:41

Subject: Re: [PATCH] Disallow empty GIT_AUTHOR_NAME or GIT_COMMITTER_NAME
Message-ID: <4692653B.1090803@nrlssc.navy.mil>
URL: https://gitlist.dev/e/4692653B.1090803%40nrlssc.navy.mil
In-Reply-To: <7vlkdsdaxo.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano wrote:
> Brandon Casey <casey@nrlssc.navy.mil> writes:
...
>> This still allows an empty GIT_AUTHOR_EMAIL or GIT_COMMITTER_EMAIL.
>> Possibly someone would want to use these variables to disable
>> the respective email address string?
>>
>> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
> 
> Thanks.  But this makes me wonder why you do not do the same
> check for !*email

I thought someone may want to disable the author or committer email
address by setting GIT_AUTHOR_EMAIL or GIT_COMMITTER_EMAIL to an
empty string. I wasn't sure this was useful that's why I put a '?'
at the end of my commit message.


>> Then I send the patch to myself using git-format-patch and then
>> git-send-email. These two format the patch appropriately for
>> submission and allow me to set the message-id.
>>
>> Then I select the message, right-click and choose "Edit As New...",
>> edit, select the recipients, and send. I also now have a record of
>> the sent message which I would not have if I used only git-send-email.
> 
> I would just add myself to --bcc when running send-email; much
> simpler ;-). 

currently I can only use send-email to send email to myself, so this
was an alternative to setting up an external editor in thunderbird.
It's currently the path of least resistance for me.

-brandon

```
