{"thread":{"id":"43233","subject":"Re: Minor documentation problems [RFC PATCH]","startedAt":"2006-11-02T10:40:23Z","lastAt":"2006-11-02T15:44:20Z","messageCount":9,"participants":["Johannes Schindelin","Petr Baudis","Matthieu Moy","Sean"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"298077","messageId":"vpqmz7a1694.fsf@ecrins.imag.fr","threadId":"43233","inReplyTo":null,"subject":"Minor documentation problems","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2006-11-02T10:40:23Z","receivedAt":"2006-11-02T10:40:23Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Hi,\n\nI'm giving a try to git/cogito after using other systems (particularly\nGNU Arch and Bazaar).\n\nI'm looking for a VCS which can suite me (willing to spend some time\nlearning it) and some collegues (NOT willing to spend more than a few\nminutes learning a new tool. \"patch\" was already too complex, and\nsomeone already requested me to send a full version instead of this\n\"weird thing that I don't have time to learn\"). I'm also looking for a\nsystem for my students, ranging from the somewhat experienced hacker\nto the mathematician not caring about computers at all.\n\nThe git/cogito duo might do it, let's see.\n\n\nI found minor problems with the doc, which deserve to be fixed:\n\n* http://www.kernel.org/pub/software/scm/cogito/docs/cg-commit.1.html\n  Mentions .git/config, but not ~/.gitconfig (which is indeed _the_\n  place where I think most people want to set their name and email).\n\n  Side note: it can be interesting to have a command to do this.\n  For example, bzr has \"bzr whoami 'me <myself@myisp.com>'\", which\n  avoids having to learn the config file syntax.\n\n* RSS link on the wiki:\n  The URL\n  http://git.or.cz/gitwiki/RecentChanges?action=rss_rc&ddiffs=1&unique=1\n  seems to be working as an RSS feed for changes, but it's not linked\n  to by http://git.or.cz/gitwiki/RecentChanges. Usually, there's an\n  RSS icon, and an HTML <link rel=\"alternate\" ...> to help finding it.\n\nThanks,\n\n-- \n"},{"id":"294111","messageId":"20061102114149.GL20017@pasky.or.cz","threadId":"43233","inReplyTo":"vpqmz7a1694.fsf@ecrins.imag.fr","subject":"Re: Minor documentation problems","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-11-02T11:41:49Z","receivedAt":"2006-11-02T11:41:49Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"  Hi,\n\nDear diary, on Thu, Nov 02, 2006 at 11:40:23AM CET, I got a letter\nwhere Matthieu Moy <Matthieu.Moy@imag.fr> said that...\n> I found minor problems with the doc, which deserve to be fixed:\n> \n> * http://www.kernel.org/pub/software/scm/cogito/docs/cg-commit.1.html\n>   Mentions .git/config, but not ~/.gitconfig (which is indeed _the_\n>   place where I think most people want to set their name and email).\n\n  thanks for pointing this out, further releases will mention both.\n\n>   Side note: it can be interesting to have a command to do this.\n>   For example, bzr has \"bzr whoami 'me <myself@myisp.com>'\", which\n>   avoids having to learn the config file syntax.\n\n  Yes, you are certainly not the first to wish this, I'm seriously\nthinking about introducing cg-admin-config for setting the most common\nconfiguration variables.\n\n  Moreover, I'm more and more thinking about removing the fallback on\nguessing based on /etc/passwd and hostname. _Many_ people were and will\nbe burnt by it, and I think it's more sane to require the user to\nconfirm once what the valid credentials are (at _that_ point it's ok to\nguess, but the user has to confirm it) than let them unconsciously do\n200 commits with completely bogus author lines.\n\n  What do the Git people think? Perhaps we could introduce GIT_NO_GUESS\nenvironment variable which will prevent var.c from guessing?\n\n> * RSS link on the wiki:\n>   The URL\n>   http://git.or.cz/gitwiki/RecentChanges?action=rss_rc&ddiffs=1&unique=1\n>   seems to be working as an RSS feed for changes, but it's not linked\n>   to by http://git.or.cz/gitwiki/RecentChanges. Usually, there's an\n>   RSS icon, and an HTML <link rel=\"alternate\" ...> to help finding it.\n\n  Fixed, thanks.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\n"},{"id":"298718","messageId":"BAYC1-PASMTP018DA61B5F35F9603DF8A8AEFF0@CEZ.ICE","threadId":"43233","inReplyTo":"vpqmz7a1694.fsf@ecrins.imag.fr","subject":"Re: Minor documentation problems [RFC PATCH]","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-11-02T12:39:43Z","receivedAt":"2006-11-02T12:39:43Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Thu, 02 Nov 2006 11:40:23 +0100\nMatthieu Moy <Matthieu.Moy@imag.fr> wrote:\n\n> * http://www.kernel.org/pub/software/scm/cogito/docs/cg-commit.1.html\n>   Mentions .git/config, but not ~/.gitconfig (which is indeed _the_\n>   place where I think most people want to set their name and email).\n> \n>   Side note: it can be interesting to have a command to do this.\n>   For example, bzr has \"bzr whoami 'me <myself@myisp.com>'\", which\n>   avoids having to learn the config file syntax.\n\nThis is the git version :\n\n$ git repo-config user.email \"myself@myisp.com\"\n$ git repo-config user.name \"me\"\n\nUnfortunately repo-config doesn't update ~/.gitconfig only\nthe .git/config file.\n\nThe patch below adds a --global option to allow:\n\n$ git repo-config --global user.email \"myself@myisp.com\"\n$ git repo-config --global user.name \"me\"\n\nAlthough the syntax is a bit depressing, it would seem to\nbe the path of least resistance.\n\nThe patch below always updates ~/.gitconfig but perhaps it\nshould respect GIT_CONFIG and/or GIT_CONFIG_LOCAL\nenvironment variables.\n\nSean\n\ndiff --git a/builtin-repo-config.c b/builtin-repo-config.c\nindex f60cee1..8c2b58a 100644\n--- a/builtin-repo-config.c\n+++ b/builtin-repo-config.c\n@@ -127,9 +127,20 @@ free_strings:\n \treturn ret;\n }\n \n+static int set_config(int global, const char* key, const char* value,\n+\t\tconst char* value_regex, int multi_replace)\n+{\n+\tif (global)\n+\t\treturn git_global_config_set_multivar(key, value,\n+\t\t\t\tvalue_regex, multi_replace);\n+\telse\n+\t\treturn git_config_set_multivar(key, value,\n+\t\t\t\tvalue_regex, multi_replace);\n+}\n+\n int cmd_repo_config(int argc, const char **argv, const char *prefix)\n {\n-\tint nongit = 0;\n+\tint nongit = 0, global = 0;\n \tsetup_git_directory_gently(&nongit);\n \n \twhile (1 < argc) {\n@@ -139,6 +150,8 @@ int cmd_repo_config(int argc, const char\n \t\t\ttype = T_BOOL;\n \t\telse if (!strcmp(argv[1], \"--list\") || !strcmp(argv[1], \"-l\"))\n \t\t\treturn git_config(show_all_config);\n+\t\telse if (!strcmp(argv[1], \"--global\"))\n+\t\t\tglobal = 1;\n \t\telse\n \t\t\tbreak;\n \t\targc--;\n@@ -150,9 +163,9 @@ int cmd_repo_config(int argc, const char\n \t\treturn get_value(argv[1], NULL);\n \tcase 3:\n \t\tif (!strcmp(argv[1], \"--unset\"))\n-\t\t\treturn git_config_set(argv[2], NULL);\n+\t\t\treturn set_config(global, argv[2], NULL, NULL, 0);\n \t\telse if (!strcmp(argv[1], \"--unset-all\"))\n-\t\t\treturn git_config_set_multivar(argv[2], NULL, NULL, 1);\n+\t\t\treturn set_config(global, argv[2], NULL, NULL, 1);\n \t\telse if (!strcmp(argv[1], \"--get\"))\n \t\t\treturn get_value(argv[2], NULL);\n \t\telse if (!strcmp(argv[1], \"--get-all\")) {\n@@ -165,12 +178,12 @@ int cmd_repo_config(int argc, const char\n \t\t\treturn get_value(argv[2], NULL);\n \t\t} else\n \n-\t\t\treturn git_config_set(argv[1], argv[2]);\n+\t\t\treturn set_config(global, argv[1], argv[2], NULL, 0);\n \tcase 4:\n \t\tif (!strcmp(argv[1], \"--unset\"))\n-\t\t\treturn git_config_set_multivar(argv[2], NULL, argv[3], 0);\n+\t\t\treturn set_config(global, argv[2], NULL, argv[3], 0);\n \t\telse if (!strcmp(argv[1], \"--unset-all\"))\n-\t\t\treturn git_config_set_multivar(argv[2], NULL, argv[3], 1);\n+\t\t\treturn set_config(global, argv[2], NULL, argv[3], 1);\n \t\telse if (!strcmp(argv[1], \"--get\"))\n \t\t\treturn get_value(argv[2], argv[3]);\n \t\telse if (!strcmp(argv[1], \"--get-all\")) {\n@@ -183,13 +196,13 @@ int cmd_repo_config(int argc, const char\n \t\t\treturn get_value(argv[2], argv[3]);\n \t\t} else if (!strcmp(argv[1], \"--replace-all\"))\n \n-\t\t\treturn git_config_set_multivar(argv[2], argv[3], NULL, 1);\n+\t\t\treturn set_config(global, argv[2], argv[3], NULL, 1);\n \t\telse\n \n-\t\t\treturn git_config_set_multivar(argv[1], argv[2], argv[3], 0);\n+\t\t\treturn set_config(global, argv[1], argv[2], argv[3], 0);\n \tcase 5:\n \t\tif (!strcmp(argv[1], \"--replace-all\"))\n-\t\t\treturn git_config_set_multivar(argv[2], argv[3], argv[4], 1);\n+\t\t\treturn set_config(global, argv[2], argv[3], argv[4], 1);\n \tcase 1:\n \tdefault:\n \t\tusage(git_config_set_usage);\ndiff --git a/cache.h b/cache.h\nindex d0a1657..5f7c599 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -402,6 +402,8 @@ extern int git_config_int(const char *,\n extern int git_config_bool(const char *, const char *);\n extern int git_config_set(const char *, const char *);\n extern int git_config_set_multivar(const char *, const char *, const char *, int);\n+extern int git_global_config_set(const char*, const char*);\n+extern int git_global_config_set_multivar(const char*, const char*, const char*, int);\n extern int check_repository_format_version(const char *var, const char *value);\n \n #define MAX_GITNAME (1000)\ndiff --git a/config.c b/config.c\nindex e8f0caf..0393b65 100644\n--- a/config.c\n+++ b/config.c\n@@ -529,22 +529,16 @@ int git_config_set(const char* key, cons\n  * - the config file is removed and the lock file rename()d to it.\n  *\n  */\n-int git_config_set_multivar(const char* key, const char* value,\n+int git_config_file_set_multivar(char* config_filename,\n+\tconst char* key, const char* value,\n \tconst char* value_regex, int multi_replace)\n {\n \tint i, dot;\n \tint fd = -1, in_fd;\n \tint ret;\n-\tchar* config_filename;\n \tchar* lock_file;\n \tconst char* last_dot = strrchr(key, '.');\n \n-\tconfig_filename = getenv(\"GIT_CONFIG\");\n-\tif (!config_filename) {\n-\t\tconfig_filename = getenv(\"GIT_CONFIG_LOCAL\");\n-\t\tif (!config_filename)\n-\t\t\tconfig_filename  = git_path(\"config\");\n-\t}\n \tconfig_filename = xstrdup(config_filename);\n \tlock_file = xstrdup(mkpath(\"%s.lock\", config_filename));\n \n@@ -742,3 +736,36 @@ out_free:\n }\n \n \n+int git_config_set_multivar(const char* key, const char* value,\n+\tconst char* value_regex, int multi_replace)\n+{\n+\tchar* config_filename;\n+\tconfig_filename = getenv(\"GIT_CONFIG\");\n+\tif (!config_filename) {\n+\t\tconfig_filename = getenv(\"GIT_CONFIG_LOCAL\");\n+\t\tif (!config_filename)\n+\t\t\tconfig_filename  = git_path(\"config\");\n+\t}\n+\treturn git_config_file_set_multivar(config_filename, key, value,\n+\t\t\t\tvalue_regex, multi_replace);\n+}\n+\n+int git_global_config_set_multivar(const char* key, const char* value,\n+\tconst char* value_regex, int multi_replace)\n+{\n+\tint ret = -1;\n+\tconst char *home = getenv(\"HOME\");\n+\tif (home) {\n+\t\tchar * global = xstrdup(mkpath(\"%s/.gitconfig\", home));\n+\t\tret = git_config_file_set_multivar(global, key, value,\n+\t\t\t\tvalue_regex, multi_replace);\n+\t\tfree(global);\n+\t}\n+\treturn ret;\n+}\n+\n+int git_global_config_set(const char* key, const char* value)\n+{\n+\treturn git_global_config_set_multivar(key, value, NULL, 0);\n+}\n"},{"id":"295602","messageId":"vpq4ptinfwz.fsf@ecrins.imag.fr","threadId":"43233","inReplyTo":"20061102114149.GL20017@pasky.or.cz","subject":"Re: Minor documentation problems","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2006-11-02T13:20:44Z","receivedAt":"2006-11-02T13:20:44Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n>   Moreover, I'm more and more thinking about removing the fallback on\n> guessing based on /etc/passwd and hostname. _Many_ people were and will\n> be burnt by it, and I think it's more sane to require the user to\n> confirm once what the valid credentials are (at _that_ point it's ok to\n> guess, but the user has to confirm it) than let them unconsciously do\n> 200 commits with completely bogus author lines.\n\nIIRC, Darcs will prompt interactively the first time and remember it.\nThe problem of interactive prompt is that it can break scripts (which\nare not always ran from an interactive prompt), so it's probably OK to\ndo this in cogito, but less so in git.\n\nOne nice thing with guess-and-don't-ask is that people who don't care\ndon't have to bother about this. I mean, some people have been\nsatisfied with CVS storing the username of the guy doing the access\nwhich is often wrong for years, so ... it's probably OK to use an\nincorrect guess for a private project with, say, <5 contributors.\n\n-- \n"},{"id":"296842","messageId":"vpqwt6em0xs.fsf@ecrins.imag.fr","threadId":"43233","inReplyTo":"BAYC1-PASMTP018DA61B5F35F9603DF8A8AEFF0@CEZ.ICE","subject":"Re: Minor documentation problems [RFC PATCH]","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2006-11-02T13:29:35Z","receivedAt":"2006-11-02T13:29:35Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Sean <seanlkml@sympatico.ca> writes:\n\n> This is the git version :\n>\n> $ git repo-config user.email \"myself@myisp.com\"\n> $ git repo-config user.name \"me\"\n\nGreat!\n\nBut this should be mentionned in\nhttp://www.kernel.org/pub/software/scm/git/docs/git-commit-tree.html\ntoo.\n\nPerhaps, \"As an alternative to editing the .git/config or ~/.gitconfig\nmanually, you can use git-repo-config\".\n\nBTW,\nhttp://www.kernel.org/pub/software/scm/git/docs/git-commit-tree.html\nalso fails to mention ~/.gitconfig.\n\n-- \n"},{"id":"296887","messageId":"Pine.LNX.4.63.0611021448100.1670@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43233","inReplyTo":"BAYC1-PASMTP018DA61B5F35F9603DF8A8AEFF0@CEZ.ICE","subject":"Re: Minor documentation problems [RFC PATCH]","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-11-02T13:54:24Z","receivedAt":"2006-11-02T13:54:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 2 Nov 2006, Sean wrote:\n\n> The patch below always updates ~/.gitconfig but perhaps it\n> should respect GIT_CONFIG and/or GIT_CONFIG_LOCAL\n> environment variables.\n\nYour patch would be loads shorter and easier to read if you'd just \noverride the GIT_CONFIG environment variable (like --git-dir sets \nGIT_DIR).\n\nCiao,\nDscho\n"},{"id":"297210","messageId":"BAYC1-PASMTP042F05A3C71EDC671552FFAEFF0@CEZ.ICE","threadId":"43233","inReplyTo":"Pine.LNX.4.63.0611021448100.1670@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Minor documentation problems [RFC PATCH]","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-11-02T14:30:14Z","receivedAt":"2006-11-02T14:30:14Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Thu, 2 Nov 2006 14:54:24 +0100 (CET)\nJohannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n\n> Your patch would be loads shorter and easier to read if you'd just \n> override the GIT_CONFIG environment variable (like --git-dir sets \n> GIT_DIR).\n> \n\nIndeed. Thanks...  How 'bout this:\n\ndiff --git a/builtin-repo-config.c b/builtin-repo-config.c\nindex f60cee1..dcdae81 100644\n--- a/builtin-repo-config.c\n+++ b/builtin-repo-config.c\n@@ -139,7 +139,16 @@ int cmd_repo_config(int argc, const char\n \t\t\ttype = T_BOOL;\n \t\telse if (!strcmp(argv[1], \"--list\") || !strcmp(argv[1], \"-l\"))\n \t\t\treturn git_config(show_all_config);\n-\t\telse\n+\t\telse if (!strcmp(argv[1], \"--global\")) {\n+\t\t\tchar *home = getenv(\"HOME\");\n+\t\t\tif (home) {\n+\t\t\t\tchar *user_config = xstrdup(mkpath(\"%s/.gitconfig\", home));\n+\t\t\t\tsetenv(\"GIT_CONFIG\", user_config, 1);\n+\t\t\t\tfree(user_config);\n+\t\t\t} else {\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t} else\n \t\t\tbreak;\n \t\targc--;\n \t\targv++;\n"},{"id":"294092","messageId":"Pine.LNX.4.63.0611021550060.1670@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43233","inReplyTo":"BAYC1-PASMTP042F05A3C71EDC671552FFAEFF0@CEZ.ICE","subject":"Re: Minor documentation problems [RFC PATCH]","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-11-02T14:51:06Z","receivedAt":"2006-11-02T14:51:06Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 2 Nov 2006, Sean wrote:\n\n> -\t\telse\n> +\t\telse if (!strcmp(argv[1], \"--global\")) {\n> +\t\t\tchar *home = getenv(\"HOME\");\n> +\t\t\tif (home) {\n> +\t\t\t\tchar *user_config = xstrdup(mkpath(\"%s/.gitconfig\", home));\n> +\t\t\t\tsetenv(\"GIT_CONFIG\", user_config, 1);\n> +\t\t\t\tfree(user_config);\n> +\t\t\t} else {\n> +\t\t\t\treturn -1;\n\nMicronit: might be useful to tell the user that she's homeless.\n\nElse: ACK.\n\nCiao,\nDscho\n"},{"id":"298764","messageId":"BAYC1-PASMTP11D0E68D26DD5FF963405FAEFF0@CEZ.ICE","threadId":"43233","inReplyTo":"Pine.LNX.4.63.0611021550060.1670@wbgn013.biozentrum.uni-wuerzburg.de","subject":"[PATCH] Add --global option to git-repo-config.","fromName":"Sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-11-02T15:44:20Z","receivedAt":"2006-11-02T15:44:20Z","isPatch":true,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"\nAllow user to set variables in global ~/.gitconfig file\nusing command line.\n\nSigned-off-by: Sean Estabrooks <seanlkml@sympatico.ca>\n---\n Documentation/git-repo-config.txt |   31 ++++++++++++++++++-------------\n builtin-repo-config.c             |   13 +++++++++++--\n 2 files changed, 29 insertions(+), 15 deletions(-)\n\ndiff --git a/Documentation/git-repo-config.txt b/Documentation/git-repo-config.txt\nindex 8a1ab61..8199615 100644\n--- a/Documentation/git-repo-config.txt\n+++ b/Documentation/git-repo-config.txt\n@@ -3,19 +3,19 @@ git-repo-config(1)\n \n NAME\n ----\n-git-repo-config - Get and set options in .git/config\n+git-repo-config - Get and set repository or global options.\n \n \n SYNOPSIS\n --------\n [verse]\n-'git-repo-config' [type] name [value [value_regex]]\n-'git-repo-config' [type] --replace-all name [value [value_regex]]\n-'git-repo-config' [type] --get name [value_regex]\n-'git-repo-config' [type] --get-all name [value_regex]\n-'git-repo-config' [type] --unset name [value_regex]\n-'git-repo-config' [type] --unset-all name [value_regex]\n-'git-repo-config' -l | --list\n+'git-repo-config' [--global] [type] name [value [value_regex]]\n+'git-repo-config' [--global] [type] --replace-all name [value [value_regex]]\n+'git-repo-config' [--global] [type] --get name [value_regex]\n+'git-repo-config' [--global] [type] --get-all name [value_regex]\n+'git-repo-config' [--global] [type] --unset name [value_regex]\n+'git-repo-config' [--global] [type] --unset-all name [value_regex]\n+'git-repo-config' [--global] -l | --list\n \n DESCRIPTION\n -----------\n@@ -41,8 +41,9 @@ This command will fail if:\n . Can not write to .git/config,\n . no section was provided,\n . the section or key is invalid,\n-. you try to unset an option which does not exist, or\n-. you try to unset/set an option for which multiple lines match.\n+. you try to unset an option which does not exist,\n+. you try to unset/set an option for which multiple lines match, or\n+. you use --global option without $HOME being properly set.\n \n \n OPTIONS\n@@ -64,14 +65,17 @@ OPTIONS\n --get-regexp::\n \tLike --get-all, but interprets the name as a regular expression.\n \n+--global::\n+\tUse global ~/.gitconfig file rather than the repository .git/config.\n+\n --unset::\n-\tRemove the line matching the key from .git/config.\n+\tRemove the line matching the key from config file.\n \n --unset-all::\n-\tRemove all matching lines from .git/config.\n+\tRemove all matching lines from config file.\n \n -l, --list::\n-\tList all variables set in .git/config.\n+\tList all variables set in config file.\n \n \n ENVIRONMENT\n@@ -79,6 +83,7 @@ ENVIRONMENT\n \n GIT_CONFIG::\n \tTake the configuration from the given file instead of .git/config.\n+\tUsing the \"--global\" option forces this to ~/.gitconfig.\n \n GIT_CONFIG_LOCAL::\n \tCurrently the same as $GIT_CONFIG; when Git will support global\ndiff --git a/builtin-repo-config.c b/builtin-repo-config.c\nindex f60cee1..7b6e572 100644\n--- a/builtin-repo-config.c\n+++ b/builtin-repo-config.c\n@@ -3,7 +3,7 @@\n #include <regex.h>\n \n static const char git_config_set_usage[] =\n-\"git-repo-config [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --unset | --unset-all] name [value [value_regex]] | --list\";\n+\"git-repo-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --unset | --unset-all] name [value [value_regex]] | --list\";\n \n static char *key;\n static regex_t *key_regexp;\n@@ -139,7 +139,16 @@ int cmd_repo_config(int argc, const char\n \t\t\ttype = T_BOOL;\n \t\telse if (!strcmp(argv[1], \"--list\") || !strcmp(argv[1], \"-l\"))\n \t\t\treturn git_config(show_all_config);\n-\t\telse\n+\t\telse if (!strcmp(argv[1], \"--global\")) {\n+\t\t\tchar *home = getenv(\"HOME\");\n+\t\t\tif (home) {\n+\t\t\t\tchar *user_config = xstrdup(mkpath(\"%s/.gitconfig\", home));\n+\t\t\t\tsetenv(\"GIT_CONFIG\", user_config, 1);\n+\t\t\t\tfree(user_config);\n+\t\t\t} else {\n+\t\t\t\tdie(\"$HOME not set\");\n+\t\t\t}\n+\t\t} else\n \t\t\tbreak;\n \t\targc--;\n \t\targv++;\n-- \n1.4.3.3.g869c\n"}]}