Re: Minor documentation problems [RFC PATCH]
- From
Sean <seanlkml@sympatico.ca>
- Date
- Nov 2, 2006, 14:30 UTC
- Message-ID
- <BAYC1-PASMTP042F05A3C71EDC671552FFAEFF0@CEZ.ICE>
- In-Reply-To
- <Pine.LNX.4.63.0611021448100.1670@wbgn013.biozentrum.uni-wuerzburg.de>
On Thu, 2 Nov 2006 14:54:24 +0100 (CET) Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Your patch would be loads shorter and easier to read if you'd just > override the GIT_CONFIG environment variable (like --git-dir sets > GIT_DIR). >
Indeed. Thanks... How 'bout this:
diff --git a/builtin-repo-config.c b/builtin-repo-config.c index f60cee1..dcdae81 100644 --- a/builtin-repo-config.c +++ b/builtin-repo-config.c @@ -139,7 +139,16 @@ int cmd_repo_config(int argc, const char type = T_BOOL; else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l")) return git_config(show_all_config); - else + else if (!strcmp(argv[1], "--global")) { + char *home = getenv("HOME"); + if (home) { + char *user_config = xstrdup(mkpath("%s/.gitconfig", home)); + setenv("GIT_CONFIG", user_config, 1); + free(user_config); + } else { + return -1; + } + } else break; argc--; argv++;