From: Sverre Rabbelier <srabbelier@gmail.com>
To: Joshua Jensen <jjensen@workspacewhiz.com>,
Jakub Narebski <jnareb@gmail.com>,
"git@vger.kernel.org" <git@vger.kernel.org>,
"Junio C Hamano" <gitster@pobox.com>
Cc: Sverre Rabbelier <srabbelier@gmail.com>
Subject: [PATCH] config: add --local option
Date: Tue, 3 Aug 2010 20:59:23 -0500 [thread overview]
Message-ID: <1280887163-22275-1-git-send-email-srabbelier@gmail.com> (raw)
This is a shorthand similar to --system but instead uses
the config file of the current repository.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
This is a resend of [0] since there is now obvious interest
in the feature by someone else.
I s/repository/local/ as requested, with the exception of
the help string, since that seemed more obvious.
[0] http://article.gmane.org/gmane.comp.version-control.git/118673
builtin/config.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index f3d1660..3cf9ff0 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -20,7 +20,7 @@ static char delim = '=';
static char key_delim = ' ';
static char term = '\n';
-static int use_global_config, use_system_config;
+static int use_global_config, use_system_config, use_local_config;
static const char *given_config_file;
static int actions, types;
static const char *get_color_slot, *get_colorbool_slot;
@@ -51,6 +51,7 @@ static struct option builtin_config_options[] = {
OPT_GROUP("Config file location"),
OPT_BOOLEAN(0, "global", &use_global_config, "use global config file"),
OPT_BOOLEAN(0, "system", &use_system_config, "use system config file"),
+ OPT_BOOLEAN(0, "local", &use_local_config, "use repository config file"),
OPT_STRING('f', "file", &given_config_file, "FILE", "use given config file"),
OPT_GROUP("Action"),
OPT_BIT(0, "get", &actions, "get value: name [value-regex]", ACTION_GET),
@@ -342,7 +343,7 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
builtin_config_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
- if (use_global_config + use_system_config + !!given_config_file > 1) {
+ if (use_global_config + use_system_config + use_local_config + !!given_config_file > 1) {
error("only one config file at a time.");
usage_with_options(builtin_config_usage, builtin_config_options);
}
@@ -358,6 +359,8 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
}
else if (use_system_config)
config_exclusive_filename = git_etc_gitconfig();
+ else if (use_local_config)
+ config_exclusive_filename = git_pathdup("config");
else if (given_config_file) {
if (!is_absolute_path(given_config_file) && prefix)
config_exclusive_filename = prefix_filename(prefix,
--
1.7.1
reply other threads:[~2010-08-04 1:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1280887163-22275-1-git-send-email-srabbelier@gmail.com \
--to=srabbelier@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jjensen@workspacewhiz.com \
--cc=jnareb@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).