git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] config: add --repository option
@ 2009-05-09 16:35 Sverre Rabbelier
  2009-06-02 10:55 ` Nanako Shiraishi
  0 siblings, 1 reply; 4+ messages in thread
From: Sverre Rabbelier @ 2009-05-09 16:35 UTC (permalink / raw)
  To: Git List; +Cc: Sverre Rabbelier

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>
---

	I often want to check what the local value of a config
	entry is, hence this patch.

 builtin-config.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/builtin-config.c b/builtin-config.c
index a81bc8b..1ae4f82 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_repository_config;
 static const char *given_config_file;
 static int actions, types;
 static const char *get_color_slot, *get_colorbool_slot;
@@ -50,6 +50,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, "repository", &use_repository_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),
@@ -319,7 +320,7 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
 	argc = parse_options(argc, argv, builtin_config_options, 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_repository_config + !!given_config_file > 1) {
 		error("only one config file at a time.");
 		usage_with_options(builtin_config_usage, builtin_config_options);
 	}
@@ -335,6 +336,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_repository_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.6.3.1.ga0e91

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] config: add --repository option
  2009-05-09 16:35 [PATCH] config: add --repository option Sverre Rabbelier
@ 2009-06-02 10:55 ` Nanako Shiraishi
  2009-06-02 15:29   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Nanako Shiraishi @ 2009-06-02 10:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sverre Rabbelier, Git List

Quoting Sverre Rabbelier <srabbelier@gmail.com>:

> 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>
> ---
>
> 	I often want to check what the local value of a config
> 	entry is, hence this patch.
>
>  builtin-config.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)

Junio, may I ask what happened to this patch?

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] config: add --repository option
  2009-06-02 10:55 ` Nanako Shiraishi
@ 2009-06-02 15:29   ` Junio C Hamano
  2009-06-02 16:38     ` Sverre Rabbelier
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2009-06-02 15:29 UTC (permalink / raw)
  To: Nanako Shiraishi; +Cc: Sverre Rabbelier, Git List

Nanako Shiraishi <nanako3@lavabit.com> writes:

> Quoting Sverre Rabbelier <srabbelier@gmail.com>:
>
>> 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>
>> ---
>>
>> 	I often want to check what the local value of a config
>> 	entry is, hence this patch.
>>
>>  builtin-config.c |    7 +++++--
>>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> Junio, may I ask what happened to this patch?

Nothing ;-)

I did see it, but simply forgot about it, as nobody else seemed to be
interested nor found anything objectionable in it.

I somehow think --repository is much harder to type than --local, and in
the context of the command, somehow --local would mesh better with other
existing options --system and --global, but that comment falls into the
bikeshedding category.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] config: add --repository option
  2009-06-02 15:29   ` Junio C Hamano
@ 2009-06-02 16:38     ` Sverre Rabbelier
  0 siblings, 0 replies; 4+ messages in thread
From: Sverre Rabbelier @ 2009-06-02 16:38 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Nanako Shiraishi, Git List

Heya,

On Tue, Jun 2, 2009 at 17:29, Junio C Hamano <gitster@pobox.com> wrote:
> I somehow think --repository is much harder to type than --local, and in
> the context of the command, somehow --local would mesh better with other
> existing options --system and --global, but that comment falls into the
> bikeshedding category.

Ha! I had --local at first, but then figured that might be confusing
since 'local' usually refers to 'on my machine', rather than 'in this
repository'. I'm fine with either.

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-02 16:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-09 16:35 [PATCH] config: add --repository option Sverre Rabbelier
2009-06-02 10:55 ` Nanako Shiraishi
2009-06-02 15:29   ` Junio C Hamano
2009-06-02 16:38     ` Sverre Rabbelier

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).