* [PATCH] Prefer $EMAIL over auto-generated user@hostname.
@ 2007-07-06 15:03 Brandon Casey
2007-07-06 15:11 ` Uwe Kleine-König
0 siblings, 1 reply; 10+ messages in thread
From: Brandon Casey @ 2007-07-06 15:03 UTC (permalink / raw)
To: torvalds, gitster; +Cc: mkraai, madcoder, git
This makes $EMAIL the second to last resort ahead of
username@hostname rather than the last resort when
GIT_AUTHOR_EMAIL or GIT_COMMITER_EMAIL and user.email
are not set.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
Linus Torvalds wrote:
>If you want it to prefer $EMAIL, you'd need to change the initialization
>of git_default_email, methinks.
How about this?
ident.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ident.c b/ident.c
index 3d49608..dc13510 100644
--- a/ident.c
+++ b/ident.c
@@ -73,6 +73,7 @@ static void copy_email(const struct passwd *pw)
static void setup_ident(void)
{
struct passwd *pw = NULL;
+ char *email;
/* Get the name ("gecos") */
if (!git_default_name[0]) {
@@ -82,6 +83,9 @@ static void setup_ident(void)
copy_gecos(pw, git_default_name, sizeof(git_default_name));
}
+ if (!git_default_email[0] && (email = getenv("EMAIL")) != NULL)
+ strlcpy(git_default_email, email, sizeof(git_default_email));
+
if (!git_default_email[0]) {
if (!pw)
pw = getpwuid(getuid());
@@ -197,8 +201,6 @@ const char *fmt_ident(const char *name, const char *email,
name = git_default_name;
if (!email)
email = git_default_email;
- if (!email)
- email = getenv("EMAIL");
if (!*name) {
struct passwd *pw;
--
1.5.3.rc0.30.g114f-dirty
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] Prefer $EMAIL over auto-generated user@hostname.
2007-07-06 15:03 [PATCH] Prefer $EMAIL over auto-generated user@hostname Brandon Casey
@ 2007-07-06 15:11 ` Uwe Kleine-König
2007-07-06 15:22 ` Brandon Casey
0 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2007-07-06 15:11 UTC (permalink / raw)
To: Brandon Casey; +Cc: torvalds, gitster, mkraai, madcoder, git
Hello Brandon,
Brandon Casey wrote:
> struct passwd *pw = NULL;
> + char *email;
Indention error. Otherwise it looks good (just from reading the patch).
Best regards
Uwe
--
Uwe Kleine-König
Set the I_WANT_A_BROKEN_PS environment variable to force BSD syntax ...
-- manpage of procps
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Prefer $EMAIL over auto-generated user@hostname.
2007-07-06 15:11 ` Uwe Kleine-König
@ 2007-07-06 15:22 ` Brandon Casey
2007-07-06 15:32 ` Johannes Schindelin
0 siblings, 1 reply; 10+ messages in thread
From: Brandon Casey @ 2007-07-06 15:22 UTC (permalink / raw)
To: Uwe Kleine-König, Brandon Casey, torvalds, gitster, mkraai,
madcoder, git
Uwe Kleine-König wrote:
> Hello Brandon,
>
> Brandon Casey wrote:
>> struct passwd *pw = NULL;
>> + char *email;
> Indention error. Otherwise it looks good (just from reading the patch).
huh. It doesn't look like that in my mail reader.
I have
struct passwd...
+ char *email;
and the patch applied cleanly when I saved the email and applied it
using git-am
cat git_email.patch | git-am
-brandon
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Prefer $EMAIL over auto-generated user@hostname.
2007-07-06 15:22 ` Brandon Casey
@ 2007-07-06 15:32 ` Johannes Schindelin
2007-07-06 15:51 ` Brandon Casey
0 siblings, 1 reply; 10+ messages in thread
From: Johannes Schindelin @ 2007-07-06 15:32 UTC (permalink / raw)
To: Brandon Casey
Cc: Uwe Kleine-König, torvalds, gitster, mkraai, madcoder, git
Hi,
On Fri, 6 Jul 2007, Brandon Casey wrote:
> Uwe Kleine-K?nig wrote:
> > Hello Brandon,
> >
> > Brandon Casey wrote:
> >> struct passwd *pw = NULL;
> >> + char *email;
> > Indention error. Otherwise it looks good (just from reading the patch).
>
> huh. It doesn't look like that in my mail reader.
> I have
> struct passwd...
> + char *email;
>
> and the patch applied cleanly when I saved the email and applied it
> using git-am
>
> cat git_email.patch | git-am
Yes, it applies cleanly. But it has 8 spaces before "char *email", not a
tab (otherwise it would be lined up with "struct passwd").
Hth,
Dscho
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Prefer $EMAIL over auto-generated user@hostname.
2007-07-06 15:32 ` Johannes Schindelin
@ 2007-07-06 15:51 ` Brandon Casey
2007-07-06 15:59 ` Alex Riesen
0 siblings, 1 reply; 10+ messages in thread
From: Brandon Casey @ 2007-07-06 15:51 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Uwe Kleine-König, torvalds, gitster, mkraai, madcoder, git
Johannes Schindelin wrote:
> Hi,
>
> On Fri, 6 Jul 2007, Brandon Casey wrote:
>
>> Uwe Kleine-K?nig wrote:
>>> Hello Brandon,
>>>
>>> Brandon Casey wrote:
>>>> struct passwd *pw = NULL;
>>>> + char *email;
>>> Indention error. Otherwise it looks good (just from reading the patch).
>> huh. It doesn't look like that in my mail reader.
>> I have
>> struct passwd...
>> + char *email;
>>
>> and the patch applied cleanly when I saved the email and applied it
>> using git-am
>>
>> cat git_email.patch | git-am
>
> Yes, it applies cleanly. But it has 8 spaces before "char *email", not a
> tab (otherwise it would be lined up with "struct passwd").
Ahh. I have expandtab set in .vimrc
This wouldn't happen to be part of the war on white space? converting
spaces to tabs where applicable?
Is the recommended tab stop 8 characters as it is for linux? or 4?
-brandon
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Prefer $EMAIL over auto-generated user@hostname.
2007-07-06 15:59 ` Alex Riesen
@ 2007-07-06 15:59 ` Vincent Hanquez
2007-07-06 16:22 ` Alex Riesen
0 siblings, 1 reply; 10+ messages in thread
From: Vincent Hanquez @ 2007-07-06 15:59 UTC (permalink / raw)
To: Alex Riesen
Cc: Brandon Casey, Johannes Schindelin, Uwe Kleine-König,
torvalds, gitster, mkraai, madcoder, git
On Fri, Jul 06, 2007 at 05:59:19PM +0200, Alex Riesen wrote:
> On 7/6/07, Brandon Casey <casey@nrlssc.navy.mil> wrote:
> >
> >Is the recommended tab stop 8 characters as it is for linux? or 4?
> >
>
> Tab is always 8 spaces. It is indentation which can be 8, 4, 3, 2, and even
> 1.
> It is 8 in Git.
tab isn't 8 spaces. a tab is a tab.
It's usually *APPEARING* at 8 spaces. they *may* appears as a different
size (to fit anyone preferences), as long as they stay as a tab (not
expanded), and that nobody is aligning on tabs.
=> this way the how many spaces should indentation be has no meaning
since everybody can choose it on their own terminal/display without
setting any value across readers of the code.
Cheers,
--
Vincent Hanquez
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Prefer $EMAIL over auto-generated user@hostname.
2007-07-06 15:51 ` Brandon Casey
@ 2007-07-06 15:59 ` Alex Riesen
2007-07-06 15:59 ` Vincent Hanquez
0 siblings, 1 reply; 10+ messages in thread
From: Alex Riesen @ 2007-07-06 15:59 UTC (permalink / raw)
To: Brandon Casey
Cc: Johannes Schindelin, Uwe Kleine-König, torvalds, gitster,
mkraai, madcoder, git
On 7/6/07, Brandon Casey <casey@nrlssc.navy.mil> wrote:
>
> Is the recommended tab stop 8 characters as it is for linux? or 4?
>
Tab is always 8 spaces. It is indentation which can be 8, 4, 3, 2, and even 1.
It is 8 in Git.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] Prefer $EMAIL over auto-generated user@hostname.
@ 2007-07-06 16:14 Brandon Casey
0 siblings, 0 replies; 10+ messages in thread
From: Brandon Casey @ 2007-07-06 16:14 UTC (permalink / raw)
To: Alex Riesen
Cc: Johannes Schindelin, Uwe Kleine-König, Linus Torvalds,
Junio C Hamano, mkraai, madcoder, Git Mailing List
This makes $EMAIL the second to last resort ahead of
username@hostname rather than the last resort when
GIT_AUTHOR_EMAIL or GIT_COMMITER_EMAIL and user.email
are not set.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
Alex Riesen wrote:
> On 7/6/07, Brandon Casey <casey@nrlssc.navy.mil> wrote:
>>
>> Is the recommended tab stop 8 characters as it is for linux? or 4?
>>
>
> Tab is always 8 spaces. It is indentation which can be 8, 4, 3, 2, and
> even 1.
> It is 8 in Git.
Here's an updated patch using tabs.
-brandon
ident.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ident.c b/ident.c
index 3d49608..be5efcd 100644
--- a/ident.c
+++ b/ident.c
@@ -73,6 +73,7 @@ static void copy_email(const struct passwd *pw)
static void setup_ident(void)
{
struct passwd *pw = NULL;
+ char *email;
/* Get the name ("gecos") */
if (!git_default_name[0]) {
@@ -82,6 +83,9 @@ static void setup_ident(void)
copy_gecos(pw, git_default_name, sizeof(git_default_name));
}
+ if (!git_default_email[0] && (email = getenv("EMAIL")) != NULL)
+ strlcpy(git_default_email, email, sizeof(git_default_email));
+
if (!git_default_email[0]) {
if (!pw)
pw = getpwuid(getuid());
@@ -197,8 +201,6 @@ const char *fmt_ident(const char *name, const char *email,
name = git_default_name;
if (!email)
email = git_default_email;
- if (!email)
- email = getenv("EMAIL");
if (!*name) {
struct passwd *pw;
--
1.5.3.rc0.30.g114f-dirty
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] Prefer $EMAIL over auto-generated user@hostname.
2007-07-06 15:59 ` Vincent Hanquez
@ 2007-07-06 16:22 ` Alex Riesen
2007-07-06 16:23 ` Alex Riesen
0 siblings, 1 reply; 10+ messages in thread
From: Alex Riesen @ 2007-07-06 16:22 UTC (permalink / raw)
To: Vincent Hanquez
Cc: Brandon Casey, Johannes Schindelin, Uwe Kleine-König,
torvalds, gitster, mkraai, madcoder, git
On 7/6/07, Vincent Hanquez <tab@snarc.org> wrote:
> On Fri, Jul 06, 2007 at 05:59:19PM +0200, Alex Riesen wrote:
> > On 7/6/07, Brandon Casey <casey@nrlssc.navy.mil> wrote:
> > >
> > >Is the recommended tab stop 8 characters as it is for linux? or 4?
> > >
> >
> > Tab is always 8 spaces. It is indentation which can be 8, 4, 3, 2, and even
> > 1.
> > It is 8 in Git.
>
> tab isn't 8 spaces. a tab is a tab.
Of course. It is used to indent the text to the next position
which multiple of 8.
> It's usually *APPEARING* at 8 spaces. they *may* appears as a different
> size (to fit anyone preferences), as long as they stay as a tab (not
> expanded), and that nobody is aligning on tabs.
>
> => this way the how many spaces should indentation be has no meaning
> since everybody can choose it on their own terminal/display without
> setting any value across readers of the code.
The symbol in question, HT, is used to indent source in the project Git.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Prefer $EMAIL over auto-generated user@hostname.
2007-07-06 16:22 ` Alex Riesen
@ 2007-07-06 16:23 ` Alex Riesen
0 siblings, 0 replies; 10+ messages in thread
From: Alex Riesen @ 2007-07-06 16:23 UTC (permalink / raw)
To: Vincent Hanquez
Cc: Brandon Casey, Johannes Schindelin, Uwe Kleine-König,
torvalds, gitster, mkraai, madcoder, git
On 7/6/07, Alex Riesen <raa.lkml@gmail.com> wrote:
> >
> > tab isn't 8 spaces. a tab is a tab.
>
> Of course. It is used to indent the text to the next position
> which multiple of 8.
>
Oh, damn... Sorry everyone, for that stupid mail.
I meant to answer only to Vincent.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-07-06 16:24 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-06 15:03 [PATCH] Prefer $EMAIL over auto-generated user@hostname Brandon Casey
2007-07-06 15:11 ` Uwe Kleine-König
2007-07-06 15:22 ` Brandon Casey
2007-07-06 15:32 ` Johannes Schindelin
2007-07-06 15:51 ` Brandon Casey
2007-07-06 15:59 ` Alex Riesen
2007-07-06 15:59 ` Vincent Hanquez
2007-07-06 16:22 ` Alex Riesen
2007-07-06 16:23 ` Alex Riesen
-- strict thread matches above, loose matches on Subject: below --
2007-07-06 16:14 Brandon Casey
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).