From: Sean Date: Thu, 02 Nov 2006 14:30:14 GMT Subject: Re: Minor documentation problems [RFC PATCH] Message-ID: In-Reply-To: On Thu, 2 Nov 2006 14:54:24 +0100 (CET) Johannes Schindelin 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++;