git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] user.default: New config to prevent using the default values for user.*
@ 2008-03-05 19:18 Santi Béjar
  2008-03-05 19:54 ` Jon Loeliger
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Santi Béjar @ 2008-03-05 19:18 UTC (permalink / raw)
  To: git; +Cc: Santi Béjar

Useful when you want a different email/name for each repository

Signed-off-by: Santi Béjar <sbejar@gmail.com>
---
 Documentation/config.txt |    5 +++++
 cache.h                  |    1 +
 config.c                 |    5 +++++
 environment.c            |    1 +
 ident.c                  |    6 +++---
 5 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 4027726..d7e5b6d 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -914,6 +914,11 @@ url.<base>.insteadOf::
 	never-before-seen repository on the site.  When more than one
 	insteadOf strings match a given URL, the longest match is used.
 
+user.default::
+	If false the defaults values for user.email and user.name are not
+	used. Useful when you want a different email/name for each
+	repository, normally set in the global config file.
+
 user.email::
 	Your email address to be recorded in any newly created commits.
 	Can be overridden by the 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_EMAIL', and
diff --git a/cache.h b/cache.h
index e230302..70f08d0 100644
--- a/cache.h
+++ b/cache.h
@@ -703,6 +703,7 @@ extern int config_error_nonbool(const char *);
 #define MAX_GITNAME (1000)
 extern char git_default_email[MAX_GITNAME];
 extern char git_default_name[MAX_GITNAME];
+extern int default_ident;
 
 extern const char *git_commit_encoding;
 extern const char *git_log_output_encoding;
diff --git a/config.c b/config.c
index 0624494..ea1fa71 100644
--- a/config.c
+++ b/config.c
@@ -445,6 +445,11 @@ int git_default_config(const char *var, const char *value)
 		return 0;
 	}
 
+	if (!strcmp(var, "user.default")) {
+		default_ident = git_config_bool(var, value);
+		return 0;
+	}
+
 	if (!strcmp(var, "i18n.commitencoding"))
 		return git_config_string(&git_commit_encoding, var, value);
 
diff --git a/environment.c b/environment.c
index 6739a3f..8e252e2 100644
--- a/environment.c
+++ b/environment.c
@@ -11,6 +11,7 @@
 
 char git_default_email[MAX_GITNAME];
 char git_default_name[MAX_GITNAME];
+int default_ident = 1;
 int trust_executable_bit = 1;
 int quote_path_fully = 1;
 int has_symlinks = 1;
diff --git a/ident.c b/ident.c
index b839dcf..0f62a94 100644
--- a/ident.c
+++ b/ident.c
@@ -75,7 +75,7 @@ static void setup_ident(void)
 	struct passwd *pw = NULL;
 
 	/* Get the name ("gecos") */
-	if (!git_default_name[0]) {
+	if (!git_default_name[0] && default_ident) {
 		pw = getpwuid(getuid());
 		if (!pw)
 			die("You don't exist. Go away!");
@@ -88,7 +88,7 @@ static void setup_ident(void)
 		if (email && email[0])
 			strlcpy(git_default_email, email,
 				sizeof(git_default_email));
-		else {
+		else if (default_ident) {
 			if (!pw)
 				pw = getpwuid(getuid());
 			if (!pw)
@@ -171,7 +171,7 @@ static const char au_env[] = "GIT_AUTHOR_NAME";
 static const char co_env[] = "GIT_COMMITTER_NAME";
 static const char *env_hint =
 "\n"
-"*** Your name cannot be determined from your system services (gecos).\n"
+"*** Your name cannot be determined.\n"
 "\n"
 "Run\n"
 "\n"
-- 
1.5.4.3.447.gc95b3.dirty


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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 19:18 [PATCH] user.default: New config to prevent using the default values for user.* Santi Béjar
@ 2008-03-05 19:54 ` Jon Loeliger
  2008-03-05 20:36   ` Santi Béjar
  2008-03-05 20:11 ` Johannes Schindelin
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: Jon Loeliger @ 2008-03-05 19:54 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git

Santi Béjar wrote:
> Useful when you want a different email/name for each repository
> 
> Signed-off-by: Santi Béjar <sbejar@gmail.com>
> ---
>  Documentation/config.txt |    5 +++++
>  cache.h                  |    1 +
>  config.c                 |    5 +++++
>  environment.c            |    1 +
>  ident.c                  |    6 +++---
>  5 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 4027726..d7e5b6d 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -914,6 +914,11 @@ url.<base>.insteadOf::
>  	never-before-seen repository on the site.  When more than one
>  	insteadOf strings match a given URL, the longest match is used.
>  
> +user.default::
> +	If false the defaults values for user.email and user.name are not

s/defaults/default

> +	used. Useful when you want a different email/name for each
> +	repository, normally set in the global config file.
> +

You already _can_ have a different email/name for each
repository, right?  Isn't the issue that you want to _force_
each repository to explicitly have these values set?

jdl


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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 19:18 [PATCH] user.default: New config to prevent using the default values for user.* Santi Béjar
  2008-03-05 19:54 ` Jon Loeliger
@ 2008-03-05 20:11 ` Johannes Schindelin
  2008-03-05 20:21 ` Daniel Barkalow
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 23+ messages in thread
From: Johannes Schindelin @ 2008-03-05 20:11 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1211 bytes --]

Hi,

On Wed, 5 Mar 2008, Santi Béjar wrote:

> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 4027726..d7e5b6d 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -914,6 +914,11 @@ url.<base>.insteadOf::
>  	never-before-seen repository on the site.  When more than one
>  	insteadOf strings match a given URL, the longest match is used.
>  
> +user.default::
> +	If false the defaults values for user.email and user.name are not
> +	used. Useful when you want a different email/name for each
> +	repository, normally set in the global config file.
> +

I have to wonder: why do you set it in global config file the first place?

And the answer...

> diff --git a/ident.c b/ident.c
> index b839dcf..0f62a94 100644
> --- a/ident.c
> +++ b/ident.c
> @@ -75,7 +75,7 @@ static void setup_ident(void)
>  	struct passwd *pw = NULL;
>  
>  	/* Get the name ("gecos") */
> -	if (!git_default_name[0]) {
> +	if (!git_default_name[0] && default_ident) {
>  		pw = getpwuid(getuid());
>  		if (!pw)
>  			die("You don't exist. Go away!");

... is here.  You are actually not at all talking about the global config 
file, but the gecos information instead.

Ciao,
Dscho

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 19:18 [PATCH] user.default: New config to prevent using the default values for user.* Santi Béjar
  2008-03-05 19:54 ` Jon Loeliger
  2008-03-05 20:11 ` Johannes Schindelin
@ 2008-03-05 20:21 ` Daniel Barkalow
  2008-03-05 20:41   ` Santi Béjar
  2008-03-05 20:44 ` Alex Riesen
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: Daniel Barkalow @ 2008-03-05 20:21 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 480 bytes --]

On Wed, 5 Mar 2008, Santi Béjar wrote:

> Useful when you want a different email/name for each repository

I still think it would be more intuitive if you made it so that setting 
user.* to nothing was not an error, suppressed picking values up from the 
system, and led (if not overridden again) to the message telling you how 
to set them. Is there some reason you decided not to have that be how the 
user triggers this behavior?

	-Daniel
*This .sig left intentionally blank*

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 19:54 ` Jon Loeliger
@ 2008-03-05 20:36   ` Santi Béjar
  0 siblings, 0 replies; 23+ messages in thread
From: Santi Béjar @ 2008-03-05 20:36 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: git

On Wed, Mar 5, 2008 at 8:54 PM, Jon Loeliger <jdl@freescale.com> wrote:
> Santi Béjar wrote:
>  > Useful when you want a different email/name for each repository
>  >
>  > Signed-off-by: Santi Béjar <sbejar@gmail.com>
>  > ---
>  >  Documentation/config.txt |    5 +++++
>  >  cache.h                  |    1 +
>  >  config.c                 |    5 +++++
>  >  environment.c            |    1 +
>  >  ident.c                  |    6 +++---
>  >  5 files changed, 15 insertions(+), 3 deletions(-)
>  >
>  > diff --git a/Documentation/config.txt b/Documentation/config.txt
>  > index 4027726..d7e5b6d 100644
>  > --- a/Documentation/config.txt
>  > +++ b/Documentation/config.txt
>  > @@ -914,6 +914,11 @@ url.<base>.insteadOf::
>  >       never-before-seen repository on the site.  When more than one
>  >       insteadOf strings match a given URL, the longest match is used.
>  >
>  > +user.default::
>  > +     If false the defaults values for user.email and user.name are not
>
>  s/defaults/default
>

Thanks

>
>  > +     used. Useful when you want a different email/name for each
>  > +     repository, normally set in the global config file.
>  > +
>
>  You already _can_ have a different email/name for each
>  repository, right?  Isn't the issue that you want to _force_
>  each repository to explicitly have these values set?
>

Maybe:
Useful when you want a different email/name for each
repository, so you can set this in the global config file and then you
are force to set the user.email and user.name in each repository.

(sorry for my non-native english)

Thanks

Santi

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 20:21 ` Daniel Barkalow
@ 2008-03-05 20:41   ` Santi Béjar
  0 siblings, 0 replies; 23+ messages in thread
From: Santi Béjar @ 2008-03-05 20:41 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git

On Wed, Mar 5, 2008 at 9:21 PM, Daniel Barkalow <barkalow@iabervon.org> wrote:
> On Wed, 5 Mar 2008, Santi Béjar wrote:
>
>
> > Useful when you want a different email/name for each repository
>
>  I still think it would be more intuitive if you made it so that setting
>  user.* to nothing was not an error, suppressed picking values up from the
>  system, and led (if not overridden again) to the message telling you how
>  to set them. Is there some reason you decided not to have that be how the
>  user triggers this behavior?

I first tried this way, but when I was writing the documentation I
found it more clean and easy if it was a separate config.

Santi

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 19:18 [PATCH] user.default: New config to prevent using the default values for user.* Santi Béjar
                   ` (2 preceding siblings ...)
  2008-03-05 20:21 ` Daniel Barkalow
@ 2008-03-05 20:44 ` Alex Riesen
  2008-03-06 21:45   ` Santi Béjar
  2008-03-05 21:01 ` Jakub Narebski
  2008-03-05 21:29 ` Junio C Hamano
  5 siblings, 1 reply; 23+ messages in thread
From: Alex Riesen @ 2008-03-05 20:44 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git

Santi Béjar, Wed, Mar 05, 2008 20:18:04 +0100:
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -914,6 +914,11 @@ url.<base>.insteadOf::
>  	never-before-seen repository on the site.  When more than one
>  	insteadOf strings match a given URL, the longest match is used.
>  
> +user.default::
> +	If false the defaults values for user.email and user.name are not

"If false the default values"... An "s" in "default" was superflous

> @@ -171,7 +171,7 @@ static const char au_env[] = "GIT_AUTHOR_NAME";
>  static const char co_env[] = "GIT_COMMITTER_NAME";
>  static const char *env_hint =
>  "\n"
> -"*** Your name cannot be determined from your system services (gecos).\n"
> +"*** Your name cannot be determined.\n"

Why not?


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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 19:18 [PATCH] user.default: New config to prevent using the default values for user.* Santi Béjar
                   ` (3 preceding siblings ...)
  2008-03-05 20:44 ` Alex Riesen
@ 2008-03-05 21:01 ` Jakub Narebski
  2008-03-05 22:35   ` Santi Béjar
  2008-03-05 21:29 ` Junio C Hamano
  5 siblings, 1 reply; 23+ messages in thread
From: Jakub Narebski @ 2008-03-05 21:01 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git

Santi Béjar <sbejar@gmail.com> writes:

> Useful when you want a different email/name for each repository

> +user.default::
> +	If false the defaults values for user.email and user.name are not
> +	used. Useful when you want a different email/name for each
> +	repository, normally set in the global config file.
> +

Wouldn't it be better to use user.noDefault, or user.explicit,
or user.dontGuess... user.default seems like place to provide
some default value, not place to decide if there should be some
fallback default values or not.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 19:18 [PATCH] user.default: New config to prevent using the default values for user.* Santi Béjar
                   ` (4 preceding siblings ...)
  2008-03-05 21:01 ` Jakub Narebski
@ 2008-03-05 21:29 ` Junio C Hamano
  2008-03-05 22:33   ` Santi Béjar
  5 siblings, 1 reply; 23+ messages in thread
From: Junio C Hamano @ 2008-03-05 21:29 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git

Santi Béjar <sbejar@gmail.com> writes:

> +user.default::
> +	If false the defaults values for user.email and user.name are not
> +	used. Useful when you want a different email/name for each
> +	repository, normally set in the global config file.
> +

Aren't there other configuration variables that you might want
to tweak per repository?

Perhaps you can make git-init run a post-init hook script by
default, and have ~/.gitconfig specify the location of it, and
have it do whatever custom settings to the per-repository
configuration file?

Wouldn't that be a more generally useful thing to do, instead of
adding special-purpose configuration variables like this?

If we go that alternate route, I would imagine that we would
need to add "--no-post-init" flag to git-init (and probably an
environment GIT_NO_POST_INIT) so that git-clone and others that
run git-init internally can disable the hook if they want to.

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 21:29 ` Junio C Hamano
@ 2008-03-05 22:33   ` Santi Béjar
  2008-03-05 22:53     ` Junio C Hamano
  0 siblings, 1 reply; 23+ messages in thread
From: Santi Béjar @ 2008-03-05 22:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Wed, Mar 5, 2008 at 10:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Santi Béjar <sbejar@gmail.com> writes:
>
>  > +user.default::
>  > +     If false the defaults values for user.email and user.name are not
>  > +     used. Useful when you want a different email/name for each
>  > +     repository, normally set in the global config file.
>  > +
>
>  Aren't there other configuration variables that you might want
>  to tweak per repository?
>
>  Perhaps you can make git-init run a post-init hook script by
>  default, and have ~/.gitconfig specify the location of it, and
>  have it do whatever custom settings to the per-repository
>  configuration file?

I would still need something to prevent doing a commit without a
locally specified name/email.

Santi

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 21:01 ` Jakub Narebski
@ 2008-03-05 22:35   ` Santi Béjar
  0 siblings, 0 replies; 23+ messages in thread
From: Santi Béjar @ 2008-03-05 22:35 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

On Wed, Mar 5, 2008 at 10:01 PM, Jakub Narebski <jnareb@gmail.com> wrote:
> Santi Béjar <sbejar@gmail.com> writes:
>
>  > Useful when you want a different email/name for each repository
>
>
> > +user.default::
>  > +     If false the defaults values for user.email and user.name are not
>  > +     used. Useful when you want a different email/name for each
>  > +     repository, normally set in the global config file.
>  > +
>
>  Wouldn't it be better to use user.noDefault, or user.explicit,
>  or user.dontGuess... user.default seems like place to provide
>  some default value, not place to decide if there should be some
>  fallback default values or not.

Make sense. I prefer user.explicit.

Santi

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 22:33   ` Santi Béjar
@ 2008-03-05 22:53     ` Junio C Hamano
  2008-03-05 23:23       ` Santi Béjar
  0 siblings, 1 reply; 23+ messages in thread
From: Junio C Hamano @ 2008-03-05 22:53 UTC (permalink / raw)
  To: Santi Béjar; +Cc: Junio C Hamano, git

"Santi Béjar" <sbejar@gmail.com> writes:

> On Wed, Mar 5, 2008 at 10:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>>  Perhaps you can make git-init run a post-init hook script by
>>  default, and have ~/.gitconfig specify the location of it, and
>>  have it do whatever custom settings to the per-repository
>>  configuration file?
>
> I would still need something to prevent doing a commit without a
> locally specified name/email.

Yes, but that something could simply be "echo '[user] name'
>.git/config" in that hook, for example.




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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 22:53     ` Junio C Hamano
@ 2008-03-05 23:23       ` Santi Béjar
  2008-03-05 23:29         ` Junio C Hamano
  0 siblings, 1 reply; 23+ messages in thread
From: Santi Béjar @ 2008-03-05 23:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Wed, Mar 5, 2008 at 11:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
> "Santi Béjar" <sbejar@gmail.com> writes:
>
>  > On Wed, Mar 5, 2008 at 10:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
>  >
>
> >>  Perhaps you can make git-init run a post-init hook script by
>  >>  default, and have ~/.gitconfig specify the location of it, and
>  >>  have it do whatever custom settings to the per-repository
>  >>  configuration file?
>  >
>  > I would still need something to prevent doing a commit without a
>  > locally specified name/email.
>
>  Yes, but that something could simply be "echo '[user] name'
>  >.git/config" in that hook, for example.

But I want a different locally specified name in each repository,
because I use different emails for different projects
(private/work/...).

Santi

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 23:23       ` Santi Béjar
@ 2008-03-05 23:29         ` Junio C Hamano
  2008-03-05 23:39           ` Santi Béjar
  0 siblings, 1 reply; 23+ messages in thread
From: Junio C Hamano @ 2008-03-05 23:29 UTC (permalink / raw)
  To: Santi Béjar; +Cc: Junio C Hamano, git

"Santi Béjar" <sbejar@gmail.com> writes:

>>  > I would still need something to prevent doing a commit without a
>>  > locally specified name/email.
>>
>>  Yes, but that something could simply be "echo '[user] name'
>>  >.git/config" in that hook, for example.
>
> But I want a different locally specified name in each repository,
> because I use different emails for different projects
> (private/work/...).

You changed your mind then?  You said you wanted to have something that
prevents a commit from being made immediately after git-init before
per-repo user.name is properly configured.  Doesn't that echo achieve that
goal?


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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 23:29         ` Junio C Hamano
@ 2008-03-05 23:39           ` Santi Béjar
  2008-03-06  0:29             ` Junio C Hamano
  0 siblings, 1 reply; 23+ messages in thread
From: Santi Béjar @ 2008-03-05 23:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Thu, Mar 6, 2008 at 12:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
> "Santi Béjar" <sbejar@gmail.com> writes:
>
>
> >>  > I would still need something to prevent doing a commit without a
>  >>  > locally specified name/email.
>  >>
>  >>  Yes, but that something could simply be "echo '[user] name'
>  >>  >.git/config" in that hook, for example.
>  >
>  > But I want a different locally specified name in each repository,
>  > because I use different emails for different projects
>  > (private/work/...).
>
>  You changed your mind then?  You said you wanted to have something that
>  prevents a commit from being made immediately after git-init before
>  per-repo user.name is properly configured.  Doesn't that echo achieve that
>  goal?

But that was in the context of the initial patch where I said that I
wanted different name/emails in each repository.

To summarize, the problem is that I work in different projects
(private/work/git/...) using the same account, but I want different
identifies (name/email) in each. So I set user.name and user.email in
each repository, but when I forget to set them git uses the default
ones (userid@hostname.(none)).

Hope I have explained it well.

Santi

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 23:39           ` Santi Béjar
@ 2008-03-06  0:29             ` Junio C Hamano
  2008-03-06  8:08               ` Santi Béjar
  0 siblings, 1 reply; 23+ messages in thread
From: Junio C Hamano @ 2008-03-06  0:29 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git

"Santi Béjar" <sbejar@gmail.com> writes:

> On Thu, Mar 6, 2008 at 12:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> "Santi Béjar" <sbejar@gmail.com> writes:
>>
>> >>  > I would still need something to prevent doing a commit without a
>>  >>  > locally specified name/email.
>>  >>
>>  >>  Yes, but that something could simply be "echo '[user] name'
>>  >>  >.git/config" in that hook, for example.
>>  >
>>  > But I want a different locally specified name in each repository,
>>  > because I use different emails for different projects
>>  > (private/work/...).
>>
>>  You changed your mind then?  You said you wanted to have something that
>>  prevents a commit from being made immediately after git-init before
>>  per-repo user.name is properly configured.  Doesn't that echo achieve that
>>  goal?
>
> But that was in the context of the initial patch where I said that I
> wanted different name/emails in each repository.
>
> To summarize, the problem is that I work in different projects
> (private/work/git/...) using the same account, but I want different
> identifies (name/email) in each. So I set user.name and user.email in
> each repository, but when I forget to set them git uses the default
> ones (userid@hostname.(none)).
>
> Hope I have explained it well.

Try:

        $ mkdir -p /var/tmp/junk && cd /var/tmp/junk
        $ git init
        $ echo '[user] name' >>.git/config
        $ >foo
        $ git add

and tell me what you see.

That's why I gave you the example of setting "[user] name"
(notice I did not say [user] name = 'Santi's name for this project')
to force you to configure it to whatever you want.

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-06  0:29             ` Junio C Hamano
@ 2008-03-06  8:08               ` Santi Béjar
  0 siblings, 0 replies; 23+ messages in thread
From: Santi Béjar @ 2008-03-06  8:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Thu, Mar 6, 2008 at 1:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> "Santi Béjar" <sbejar@gmail.com> writes:
>
>  > On Thu, Mar 6, 2008 at 12:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
>  >> "Santi Béjar" <sbejar@gmail.com> writes:
>  >>
>  >> >>  > I would still need something to prevent doing a commit without a
>  >>  >>  > locally specified name/email.
>  >>  >>
>  >>  >>  Yes, but that something could simply be "echo '[user] name'
>  >>  >>  >.git/config" in that hook, for example.
>  >>  >
>  >>  > But I want a different locally specified name in each repository,
>  >>  > because I use different emails for different projects
>  >>  > (private/work/...).
>  >>
>  >>  You changed your mind then?  You said you wanted to have something that
>  >>  prevents a commit from being made immediately after git-init before
>  >>  per-repo user.name is properly configured.  Doesn't that echo achieve that
>  >>  goal?
>  >
>  > But that was in the context of the initial patch where I said that I
>  > wanted different name/emails in each repository.
>  >
>  > To summarize, the problem is that I work in different projects
>  > (private/work/git/...) using the same account, but I want different
>  > identifies (name/email) in each. So I set user.name and user.email in
>  > each repository, but when I forget to set them git uses the default
>  > ones (userid@hostname.(none)).
>  >
>  > Hope I have explained it well.
>
>  Try:
>
>         $ mkdir -p /var/tmp/junk && cd /var/tmp/junk
>         $ git init
>
>         $ echo '[user] name' >>.git/config
>         $ >foo
>         $ git add
>
>  and tell me what you see.

Every single command fails because it no longer a valid git repository.

>
>  That's why I gave you the example of setting "[user] name"
>  (notice I did not say [user] name = 'Santi's name for this project')
>  to force you to configure it to whatever you want.

But then I have to configure in all the repositories, even the ones I
do not develop.

Santi

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-05 20:44 ` Alex Riesen
@ 2008-03-06 21:45   ` Santi Béjar
  2008-03-07 16:41     ` Alex Riesen
  0 siblings, 1 reply; 23+ messages in thread
From: Santi Béjar @ 2008-03-06 21:45 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

On Wed, Mar 5, 2008 at 9:44 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
> Santi Béjar, Wed, Mar 05, 2008 20:18:04 +0100:
>
>  > @@ -171,7 +171,7 @@ static const char au_env[] = "GIT_AUTHOR_NAME";
>  >  static const char co_env[] = "GIT_COMMITTER_NAME";
>  >  static const char *env_hint =
>  >  "\n"
>  > -"*** Your name cannot be determined from your system services (gecos).\n"
>  > +"*** Your name cannot be determined.\n"
>
>  Why not?

Is this important? Or in another way, is this useful? The important
thing is how you can fix it. But others think otherwise I'll change it
to explain the reason.

Santi

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-06 21:45   ` Santi Béjar
@ 2008-03-07 16:41     ` Alex Riesen
  2008-03-08  0:13       ` Santi Béjar
  0 siblings, 1 reply; 23+ messages in thread
From: Alex Riesen @ 2008-03-07 16:41 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git

Santi Béjar, Thu, Mar 06, 2008 22:45:43 +0100:
> On Wed, Mar 5, 2008 at 9:44 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
> > Santi Béjar, Wed, Mar 05, 2008 20:18:04 +0100:
> >
> >  > @@ -171,7 +171,7 @@ static const char au_env[] = "GIT_AUTHOR_NAME";
> >  >  static const char co_env[] = "GIT_COMMITTER_NAME";
> >  >  static const char *env_hint =
> >  >  "\n"
> >  > -"*** Your name cannot be determined from your system services (gecos).\n"
> >  > +"*** Your name cannot be determined.\n"
> >
> >  Why not?
> 
> Is this important? Or in another way, is this useful? The important
> thing is how you can fix it. But others think otherwise I'll change it
> to explain the reason.

It is precise explanation of what happened. It could be a hint to fix
gecos field to someone. It is considered useful not to hide
information, even if you have no idea of how useful it is. Others may
be smarter than you.

It could be shortened, thopugh. Maybe remove the asterisks, and
replace "from your system services (gecos)" with a shorter (but
precise) information.


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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-07 16:41     ` Alex Riesen
@ 2008-03-08  0:13       ` Santi Béjar
  2008-03-08  1:24         ` Johannes Schindelin
  0 siblings, 1 reply; 23+ messages in thread
From: Santi Béjar @ 2008-03-08  0:13 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

On Fri, Mar 7, 2008 at 5:41 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
> Santi Béjar, Thu, Mar 06, 2008 22:45:43 +0100:
>
>
> > On Wed, Mar 5, 2008 at 9:44 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
>  > > Santi Béjar, Wed, Mar 05, 2008 20:18:04 +0100:
>  > >
>  > >  > @@ -171,7 +171,7 @@ static const char au_env[] = "GIT_AUTHOR_NAME";
>  > >  >  static const char co_env[] = "GIT_COMMITTER_NAME";
>  > >  >  static const char *env_hint =
>  > >  >  "\n"
>  > >  > -"*** Your name cannot be determined from your system services (gecos).\n"
>  > >  > +"*** Your name cannot be determined.\n"
>  > >
>  > >  Why not?
>  >
>  > Is this important? Or in another way, is this useful? The important
>  > thing is how you can fix it. But others think otherwise I'll change it
>  > to explain the reason.
>
>  It is precise explanation of what happened. It could be a hint to fix
>  gecos field to someone. It is considered useful not to hide
>  information, even if you have no idea of how useful it is.

I'll wait for others to comment.

>  Others may
>  be smarter than you.

I don't think this is necessary.

Santi

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-08  0:13       ` Santi Béjar
@ 2008-03-08  1:24         ` Johannes Schindelin
  2008-03-08  2:08           ` Junio C Hamano
  0 siblings, 1 reply; 23+ messages in thread
From: Johannes Schindelin @ 2008-03-08  1:24 UTC (permalink / raw)
  To: Santi Béjar; +Cc: Alex Riesen, git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1519 bytes --]

Hi,

On Sat, 8 Mar 2008, Santi Béjar wrote:

> On Fri, Mar 7, 2008 at 5:41 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
> > Santi Béjar, Thu, Mar 06, 2008 22:45:43 +0100:
> >
> >
> > > On Wed, Mar 5, 2008 at 9:44 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
> >  > > Santi Béjar, Wed, Mar 05, 2008 20:18:04 +0100:
> >  > >
> >  > >  > @@ -171,7 +171,7 @@ static const char au_env[] = "GIT_AUTHOR_NAME";
> >  > >  >  static const char co_env[] = "GIT_COMMITTER_NAME";
> >  > >  >  static const char *env_hint =
> >  > >  >  "\n"
> >  > >  > -"*** Your name cannot be determined from your system services (gecos).\n"
> >  > >  > +"*** Your name cannot be determined.\n"
> >  > >
> >  > >  Why not?
> >  >
> >  > Is this important? Or in another way, is this useful? The important
> >  > thing is how you can fix it. But others think otherwise I'll change it
> >  > to explain the reason.
> >
> >  It is precise explanation of what happened. It could be a hint to fix
> >  gecos field to someone. It is considered useful not to hide
> >  information, even if you have no idea of how useful it is.
> 
> I'll wait for others to comment.

I thought I asked why you had to remove the comment (which seems not to 
have a proper reasoning in the commit message), but maybe I did not.

So here it is in writing: I agree with Alex on the criticism on this part 
of your patch.

> >  Others may be smarter than you.
> 
> I don't think this is necessary.

It is not necessary that others may be smarter than you, alright.

Hth,
Dscho

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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-08  1:24         ` Johannes Schindelin
@ 2008-03-08  2:08           ` Junio C Hamano
  2008-03-08  2:22             ` Johannes Schindelin
  0 siblings, 1 reply; 23+ messages in thread
From: Junio C Hamano @ 2008-03-08  2:08 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Santi Béjar, Alex Riesen, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Sat, 8 Mar 2008, Santi Béjar wrote:
>
>> On Fri, Mar 7, 2008 at 5:41 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
>> > Santi Béjar, Thu, Mar 06, 2008 22:45:43 +0100:
>> >
>> > > On Wed, Mar 5, 2008 at 9:44 PM, Alex Riesen <raa.lkml@gmail.com> wrote:
>> >  > > Santi Béjar, Wed, Mar 05, 2008 20:18:04 +0100:
>> >  > >
>> >  > >  > @@ -171,7 +171,7 @@ static const char au_env[] = "GIT_AUTHOR_NAME";
>> >  > >  >  static const char co_env[] = "GIT_COMMITTER_NAME";
>> >  > >  >  static const char *env_hint =
>> >  > >  >  "\n"
>> >  > >  > -"*** Your name cannot be determined from your system services (gecos).\n"
>> >  > >  > +"*** Your name cannot be determined.\n"
>> >  > >
>> >  > >  Why not?
>> >  >
>> >  > Is this important? Or in another way, is this useful? The important
>> >  > thing is how you can fix it. But others think otherwise I'll change it
>> >  > to explain the reason.
>> >
>> >  It is precise explanation of what happened. It could be a hint to fix
>> >  gecos field to someone. It is considered useful not to hide
>> >  information, even if you have no idea of how useful it is.

I'd agree with that reasoning on one condition, that is, msysgit folks
would adjust this to whatever gecos equivalent is called in the Windows
world ;-).

I do not personally think this part of the patch is so bad to waste your
brain cells and time arguing about.  I would even suggest removing the
whole "cannot be determined" and just say "Please tell me who you are."

Yes, if you tell people that a lacking GECOS is the underlying reason that
you are getting this message, it would hint them an alternative solution
of talking to their sysadmin to get it fixed, and that one-shot fix will
last for all repositories on that machine (and machines that consult the
same NIS/LDAP for name information).  However, the "config --global"
suggested in that message is also a valid one-shot fix, and hopefully
one-shot across machines that NFS mounts the home directories.  The latter
knowledge can hopefully be reused when you are forced to use git on
Windows, but the fix based on GECOS would probably not.

So I'd even argue that Santi's change to the message is an improvement
that removes geekspeak that is not particularly useful to the end user
in this context.

However, I would also say that this message improvement does not belong to
user.default or whatever the configuration variable is called in this
round of proposal.  It should be a separate patch, and it would be a much
easier sell than the rest of the patch series.


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

* Re: [PATCH] user.default: New config to prevent using the default values for user.*
  2008-03-08  2:08           ` Junio C Hamano
@ 2008-03-08  2:22             ` Johannes Schindelin
  0 siblings, 0 replies; 23+ messages in thread
From: Johannes Schindelin @ 2008-03-08  2:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Santi Béjar, Alex Riesen, git

Hi,

On Fri, 7 Mar 2008, Junio C Hamano wrote:

> So I'd even argue that Santi's change to the message is an improvement 
> that removes geekspeak that is not particularly useful to the end user 
> in this context.
> 
> However, I would also say that this message improvement does not belong 
> to user.default or whatever the configuration variable is called in this 
> round of proposal.  It should be a separate patch, and it would be a 
> much easier sell than the rest of the patch series.

That was the whole point of Alex' criticism.  I was slightly irritated 
that his comments elicited a criticism of their own.

Sorry for that,
Dscho


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

end of thread, other threads:[~2008-03-08  2:23 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 19:18 [PATCH] user.default: New config to prevent using the default values for user.* Santi Béjar
2008-03-05 19:54 ` Jon Loeliger
2008-03-05 20:36   ` Santi Béjar
2008-03-05 20:11 ` Johannes Schindelin
2008-03-05 20:21 ` Daniel Barkalow
2008-03-05 20:41   ` Santi Béjar
2008-03-05 20:44 ` Alex Riesen
2008-03-06 21:45   ` Santi Béjar
2008-03-07 16:41     ` Alex Riesen
2008-03-08  0:13       ` Santi Béjar
2008-03-08  1:24         ` Johannes Schindelin
2008-03-08  2:08           ` Junio C Hamano
2008-03-08  2:22             ` Johannes Schindelin
2008-03-05 21:01 ` Jakub Narebski
2008-03-05 22:35   ` Santi Béjar
2008-03-05 21:29 ` Junio C Hamano
2008-03-05 22:33   ` Santi Béjar
2008-03-05 22:53     ` Junio C Hamano
2008-03-05 23:23       ` Santi Béjar
2008-03-05 23:29         ` Junio C Hamano
2008-03-05 23:39           ` Santi Béjar
2008-03-06  0:29             ` Junio C Hamano
2008-03-06  8:08               ` Santi Béjar

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