Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2011-05-17 19:38:52 +0400
committerJunio C Hamano <gitster@pobox.com>2011-05-18 08:01:17 +0400
commit7a39741999a5216257b1fbcc847cf0c62c114088 (patch)
tree56bad681465958014dd2cff968eb684c2d729509 /config.c
parentb602ed7dea968d72c5b3f61ca016de7f285d80ef (diff)
config: define and document exit codes
The return codes of git_config_set() and friends are magic numbers right in the source. #define them in cache.h where the functions are declared, and use the constants in the source. Also, mention the resulting exit codes of "git config" in its man page (and complete the list). Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/config.c b/config.c
index 671c8df2cc..9d36848889 100644
--- a/config.c
+++ b/config.c
@@ -1123,12 +1123,12 @@ int git_config_parse_key(const char *key, char **store_key, int *baselen_)
if (last_dot == NULL || last_dot == key) {
error("key does not contain a section: %s", key);
- return -2;
+ return -CONFIG_NO_SECTION_OR_NAME;
}
if (!last_dot[1]) {
error("key does not contain variable name: %s", key);
- return -2;
+ return -CONFIG_NO_SECTION_OR_NAME;
}
baselen = last_dot - key;
@@ -1165,7 +1165,7 @@ int git_config_parse_key(const char *key, char **store_key, int *baselen_)
out_free_ret_1:
free(*store_key);
- return -1;
+ return -CONFIG_INVALID_KEY;
}
/*
@@ -1221,7 +1221,7 @@ int git_config_set_multivar(const char *key, const char *value,
if (fd < 0) {
error("could not lock config file %s: %s", config_filename, strerror(errno));
free(store.key);
- ret = -1;
+ ret = CONFIG_NO_LOCK;
goto out_free;
}
@@ -1235,12 +1235,12 @@ int git_config_set_multivar(const char *key, const char *value,
if ( ENOENT != errno ) {
error("opening %s: %s", config_filename,
strerror(errno));
- ret = 3; /* same as "invalid config file" */
+ ret = CONFIG_INVALID_FILE; /* same as "invalid config file" */
goto out_free;
}
/* if nothing to unset, error out */
if (value == NULL) {
- ret = 5;
+ ret = CONFIG_NOTHING_SET;
goto out_free;
}
@@ -1268,7 +1268,7 @@ int git_config_set_multivar(const char *key, const char *value,
REG_EXTENDED)) {
error("invalid pattern: %s", value_regex);
free(store.value_regex);
- ret = 6;
+ ret = CONFIG_INVALID_PATTERN;
goto out_free;
}
}
@@ -1290,7 +1290,7 @@ int git_config_set_multivar(const char *key, const char *value,
regfree(store.value_regex);
free(store.value_regex);
}
- ret = 3;
+ ret = CONFIG_INVALID_FILE;
goto out_free;
}
@@ -1303,7 +1303,7 @@ int git_config_set_multivar(const char *key, const char *value,
/* if nothing to unset, or too many matches, error out */
if ((store.seen == 0 && value == NULL) ||
(store.seen > 1 && multi_replace == 0)) {
- ret = 5;
+ ret = CONFIG_NOTHING_SET;
goto out_free;
}
@@ -1364,7 +1364,7 @@ int git_config_set_multivar(const char *key, const char *value,
if (commit_lock_file(lock) < 0) {
error("could not commit config file %s", config_filename);
- ret = 4;
+ ret = CONFIG_NO_WRITE;
goto out_free;
}