summaryrefslogtreecommitdiff
path: root/builtin/config.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-07-21 07:49:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-23 18:19:09 (GMT)
commit1a07e59c3e269418f3f5d186d166bf5ab5db6667 (patch)
treeaf7144a561d023b0d095c6c5463d00fe05248be6 /builtin/config.c
parente3331758f12da22f4103eec7efe1b5304a9be5e9 (diff)
downloadgit-1a07e59c3e269418f3f5d186d166bf5ab5db6667.zip
git-1a07e59c3e269418f3f5d186d166bf5ab5db6667.tar.gz
git-1a07e59c3e269418f3f5d186d166bf5ab5db6667.tar.bz2
Update messages in preparation for i18n
Many messages will be marked for translation in the following commits. This commit updates some of them to be more consistent and reduce diff noise in those commits. Changes are - keep the first letter of die(), error() and warning() in lowercase - no full stop in die(), error() or warning() if it's single sentence messages - indentation - some messages are turned to BUG(), or prefixed with "BUG:" and will not be marked for i18n - some messages are improved to give more information - some messages are broken down by sentence to be i18n friendly (on the same token, combine multiple warning() into one big string) - the trailing \n is converted to printf_ln if possible, or deleted if not redundant - errno_errno() is used instead of explicit strerror() Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/config.c')
-rw-r--r--builtin/config.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/builtin/config.c b/builtin/config.c
index b29d26d..a09ead5 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -110,7 +110,7 @@ static int option_parse_type(const struct option *opt, const char *arg,
* --int' and '--type=bool
* --type=int'.
*/
- error("only one type at a time.");
+ error("only one type at a time");
usage_with_options(builtin_config_usage,
builtin_config_options);
}
@@ -160,7 +160,11 @@ static struct option builtin_config_options[] = {
static void check_argc(int argc, int min, int max) {
if (argc >= min && argc <= max)
return;
- error("wrong number of arguments");
+ if (min == max)
+ error("wrong number of arguments, should be %d", min);
+ else
+ error("wrong number of arguments, should be from %d to %d",
+ min, max);
usage_with_options(builtin_config_usage, builtin_config_options);
}
@@ -595,7 +599,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
if (use_global_config + use_system_config + use_local_config +
!!given_config_source.file + !!given_config_source.blob > 1) {
- error("only one config file at a time.");
+ error("only one config file at a time");
usage_with_options(builtin_config_usage, builtin_config_options);
}
@@ -664,7 +668,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
}
if (HAS_MULTI_BITS(actions)) {
- error("only one action at a time.");
+ error("only one action at a time");
usage_with_options(builtin_config_usage, builtin_config_options);
}
if (actions == 0)
@@ -684,7 +688,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
if (show_origin && !(actions &
(ACTION_GET|ACTION_GET_ALL|ACTION_GET_REGEXP|ACTION_LIST))) {
error("--show-origin is only applicable to --get, --get-all, "
- "--get-regexp, and --list.");
+ "--get-regexp, and --list");
usage_with_options(builtin_config_usage, builtin_config_options);
}
@@ -819,7 +823,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
if (ret < 0)
return ret;
if (ret == 0)
- die("No such section!");
+ die("no such section: %s", argv[0]);
}
else if (actions == ACTION_REMOVE_SECTION) {
int ret;
@@ -830,7 +834,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
if (ret < 0)
return ret;
if (ret == 0)
- die("No such section!");
+ die("no such section: %s", argv[0]);
}
else if (actions == ACTION_GET_COLOR) {
check_argc(argc, 1, 2);