[PATCH] Add a --user option to git-config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At present, the --global option is something of a misnomer, so
we introduce the --user option as a synonym, with the intention
of removing the old option in the future.

Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxx>
---

I have recently had the need to create a ~/.gitconfig file for the
first time and I was reminded of this patch. Maybe it's just me who
thinks that --global is odd ... ;-)  Particularly since the system
config file was added.

Actually my config editor of choice is vim, so this is not a high
priority for me.

[This is against 1.5.2, but will hopefully not be too difficult to
forward to current git]

ATB,

Ramsay Jones

 Documentation/git-config.txt           |   30 +++++++++++++++---------------
 Documentation/git-repo-config.txt      |    2 +-
 Documentation/tutorial.txt             |    4 ++--
 Documentation/user-manual.txt          |    2 +-
 builtin-config.c                       |    5 +++--
 contrib/completion/git-completion.bash |    2 +-
 ident.c                                |    2 +-
 7 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
index 280ef20..26138c4 100644
--- a/Documentation/git-config.txt
+++ b/Documentation/git-config.txt
@@ -3,22 +3,22 @@ git-config(1)
 
 NAME
 ----
-git-config - Get and set repository or global options
+git-config - Get and set repository, user or system-wide options
 
 
 SYNOPSIS
 --------
 [verse]
-'git-config' [--system | --global] [type] name [value [value_regex]]
-'git-config' [--system | --global] [type] --add name value
-'git-config' [--system | --global] [type] --replace-all name [value [value_regex]]
-'git-config' [--system | --global] [type] --get name [value_regex]
-'git-config' [--system | --global] [type] --get-all name [value_regex]
-'git-config' [--system | --global] [type] --unset name [value_regex]
-'git-config' [--system | --global] [type] --unset-all name [value_regex]
-'git-config' [--system | --global] [type] --rename-section old_name new_name
-'git-config' [--system | --global] [type] --remove-section name
-'git-config' [--system | --global] -l | --list
+'git-config' [--system | --user] [type] name [value [value_regex]]
+'git-config' [--system | --user] [type] --add name value
+'git-config' [--system | --user] [type] --replace-all name [value [value_regex]]
+'git-config' [--system | --user] [type] --get name [value_regex]
+'git-config' [--system | --user] [type] --get-all name [value_regex]
+'git-config' [--system | --user] [type] --unset name [value_regex]
+'git-config' [--system | --user] [type] --unset-all name [value_regex]
+'git-config' [--system | --user] [type] --rename-section old_name new_name
+'git-config' [--system | --user] [type] --remove-section name
+'git-config' [--system | --user] -l | --list
 
 DESCRIPTION
 -----------
@@ -47,7 +47,7 @@ This command will fail if:
 . the section or key is invalid,
 . you try to unset an option which does not exist,
 . you try to unset/set an option for which multiple lines match, or
-. you use --global option without $HOME being properly set.
+. you use --user option without $HOME being properly set.
 
 
 OPTIONS
@@ -73,8 +73,8 @@ OPTIONS
 --get-regexp::
 	Like --get-all, but interprets the name as a regular expression.
 
---global::
-	Use global ~/.gitconfig file rather than the repository .git/config.
+--user::
+	Use per user ~/.gitconfig file rather than the repository .git/config.
 
 --system::
 	Use system-wide $(prefix)/etc/gitconfig rather than the repository
@@ -110,7 +110,7 @@ ENVIRONMENT
 
 GIT_CONFIG::
 	Take the configuration from the given file instead of .git/config.
-	Using the "--global" option forces this to ~/.gitconfig.
+	Using the "--user" option forces this to ~/.gitconfig.
 
 GIT_CONFIG_LOCAL::
 	Currently the same as $GIT_CONFIG; when Git will support global
diff --git a/Documentation/git-repo-config.txt b/Documentation/git-repo-config.txt
index 2deba31..8eec3cd 100644
--- a/Documentation/git-repo-config.txt
+++ b/Documentation/git-repo-config.txt
@@ -3,7 +3,7 @@ git-repo-config(1)
 
 NAME
 ----
-git-repo-config - Get and set repository or global options
+git-repo-config - Get and set repository, user or system-wide options
 
 
 SYNOPSIS
diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt
index f55d408..a401638 100644
--- a/Documentation/tutorial.txt
+++ b/Documentation/tutorial.txt
@@ -20,8 +20,8 @@ public email address before doing any operation.  The easiest
 way to do so is:
 
 ------------------------------------------------
-$ git config --global user.name "Your Name Comes Here"
-$ git config --global user.email you@xxxxxxxxxxxxxxxxxxxxxx
+$ git config --user user.name "Your Name Comes Here"
+$ git config --user user.email you@xxxxxxxxxxxxxxxxxxxxxx
 ------------------------------------------------
 
 
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 52247aa..105e362 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -1147,7 +1147,7 @@ The file specified by the `core.excludesfile` config directive:::
 	   more information on configuration options). This config directive
 	   can be set in the per-repo `.git/config` file, in which case the
 	   exclude patterns will apply to that repo only. Alternatively, you
-	   can set the directive in the global `~/.gitconfig` file to apply
+	   can set the directive in the per-user `~/.gitconfig` file to apply
 	   the exclude pattern to all your git repos. As with the above
 	   `.git/info/exclude` (and, indeed, with git config directives in
 	   general), this directive does not follow push/pull/clone, but remain
diff --git a/builtin-config.c b/builtin-config.c
index b2515f7..1850d9d 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -2,7 +2,7 @@
 #include "cache.h"
 
 static const char git_config_set_usage[] =
-"git-config [ --global | --system ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --remove-section name | --list";
+"git-config [ --user | --system ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --remove-section name | --list";
 
 static char *key;
 static regex_t *key_regexp;
@@ -143,7 +143,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 			type = T_BOOL;
 		else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l"))
 			return git_config(show_all_config);
-		else if (!strcmp(argv[1], "--global")) {
+		else if (!strcmp(argv[1], "--user") ||
+				!strcmp(argv[1], "--global")) {
 			char *home = getenv("HOME");
 			if (home) {
 				char *user_config = xstrdup(mkpath("%s/.gitconfig", home));
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 46356e8..cb5a457 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -745,7 +745,7 @@ _git_config ()
 	case "$cur" in
 	--*)
 		__gitcomp "
-			--global --list --replace-all
+			--user --list --replace-all
 			--get --get-all --get-regexp
 			--add --unset --unset-all
 			"
diff --git a/ident.c b/ident.c
index 69a04b8..21dca3a 100644
--- a/ident.c
+++ b/ident.c
@@ -182,7 +182,7 @@ static const char *env_hint =
 "  git config user.name \"Your Name\"\n"
 "\n"
 "To set the identity in this repository.\n"
-"Add --global to set your account\'s default\n"
+"Add --user to set your account\'s default\n"
 "\n";
 
 const char *fmt_ident(const char *name, const char *email,
-- 
1.5.2


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux