{"thread":{"id":"24626","subject":"[PATCH] config: add --local option","startedAt":"2010-08-04T01:59:23Z","lastAt":"2010-08-04T01:59:23Z","messageCount":1,"participants":["Sverre Rabbelier"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"147085","messageId":"1280887163-22275-1-git-send-email-srabbelier@gmail.com","threadId":"24626","inReplyTo":null,"subject":"[PATCH] config: add --local option","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-08-04T01:59:23Z","receivedAt":"2010-08-04T01:59:23Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"This is a shorthand similar to --system but instead uses\nthe config file of the current repository.\n\nSigned-off-by: Sverre Rabbelier <srabbelier@gmail.com>\n---\n\n\tThis is a resend of [0] since there is now obvious interest\n\tin the feature by someone else.\n\n\tI s/repository/local/ as requested, with the exception of\n\tthe help string, since that seemed more obvious.\n\n\t[0] http://article.gmane.org/gmane.comp.version-control.git/118673\n\n builtin/config.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex f3d1660..3cf9ff0 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -20,7 +20,7 @@ static char delim = '=';\n static char key_delim = ' ';\n static char term = '\\n';\n \n-static int use_global_config, use_system_config;\n+static int use_global_config, use_system_config, use_local_config;\n static const char *given_config_file;\n static int actions, types;\n static const char *get_color_slot, *get_colorbool_slot;\n@@ -51,6 +51,7 @@ static struct option builtin_config_options[] = {\n \tOPT_GROUP(\"Config file location\"),\n \tOPT_BOOLEAN(0, \"global\", &use_global_config, \"use global config file\"),\n \tOPT_BOOLEAN(0, \"system\", &use_system_config, \"use system config file\"),\n+\tOPT_BOOLEAN(0, \"local\", &use_local_config, \"use repository config file\"),\n \tOPT_STRING('f', \"file\", &given_config_file, \"FILE\", \"use given config file\"),\n \tOPT_GROUP(\"Action\"),\n \tOPT_BIT(0, \"get\", &actions, \"get value: name [value-regex]\", ACTION_GET),\n@@ -342,7 +343,7 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)\n \t\t\t     builtin_config_usage,\n \t\t\t     PARSE_OPT_STOP_AT_NON_OPTION);\n \n-\tif (use_global_config + use_system_config + !!given_config_file > 1) {\n+\tif (use_global_config + use_system_config + use_local_config + !!given_config_file > 1) {\n \t\terror(\"only one config file at a time.\");\n \t\tusage_with_options(builtin_config_usage, builtin_config_options);\n \t}\n@@ -358,6 +359,8 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)\n \t}\n \telse if (use_system_config)\n \t\tconfig_exclusive_filename = git_etc_gitconfig();\n+\telse if (use_local_config)\n+\t\tconfig_exclusive_filename = git_pathdup(\"config\");\n \telse if (given_config_file) {\n \t\tif (!is_absolute_path(given_config_file) && prefix)\n \t\t\tconfig_exclusive_filename = prefix_filename(prefix,\n-- \n1.7.1\n"}]}