summaryrefslogtreecommitdiff
path: root/builtin-config.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2007-03-02 21:53:33 +0100
committerJunio C Hamano <junkio@cox.net>2007-03-03 19:59:37 -0800
commit118f8b241355b38cd21e644e8620d81f10190627 (patch)
tree49cdd292779b9204b5cf2ef85981952f542c3848 /builtin-config.c
parent253e772edeb56092e0fad43ec0640658671313c5 (diff)
downloadgit-118f8b241355b38cd21e644e8620d81f10190627.tar.gz
git-config: document --rename-section, provide --remove-section
This patch documents the previously undocumented option --rename-section and adds a new option to zap an entire section. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-config.c')
-rw-r--r--builtin-config.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/builtin-config.c b/builtin-config.c
index f1433a4ab6..dfa403b94b 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -2,7 +2,7 @@
#include "cache.h"
static const char git_config_set_usage[] =
-"git-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --list";
+"git-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --remove-section name | --list";
static char *key;
static regex_t *key_regexp;
@@ -168,6 +168,19 @@ int cmd_config(int argc, const char **argv, const char *prefix)
}
return 0;
}
+ else if (!strcmp(argv[1], "--remove-section")) {
+ int ret;
+ if (argc != 3)
+ usage(git_config_set_usage);
+ ret = git_config_rename_section(argv[2], NULL);
+ if (ret < 0)
+ return ret;
+ if (ret == 0) {
+ fprintf(stderr, "No such section!\n");
+ return 1;
+ }
+ return 0;
+ }
else
break;
argc--;