summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-02-22 11:23:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-22 18:23:55 (GMT)
commit30598ad06f2adfef1f74d6348677358865cbf373 (patch)
tree26384fa5cdedcc280625f416f899086c5ac5823d /config.c
parent2f29c1bf34ec12c24072bb54a2c009bd1f17a2ee (diff)
downloadgit-30598ad06f2adfef1f74d6348677358865cbf373.zip
git-30598ad06f2adfef1f74d6348677358865cbf373.tar.gz
git-30598ad06f2adfef1f74d6348677358865cbf373.tar.bz2
config: rename git_config_set to git_config_set_gently
The desired default behavior for `git_config_set` is to die whenever an error occurs. Dying is the default for a lot of internal functions when failures occur and is in this case the right thing to do for most callers as otherwise we might run into inconsistent repositories without noticing. As some code may rely on the actual return values for `git_config_set` we still require the ability to invoke these functions without aborting. Rename the existing `git_config_set` functions to `git_config_set_gently` to keep them available for those callers. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/config.c b/config.c
index 856f7d34..e7f42da 100644
--- a/config.c
+++ b/config.c
@@ -1825,10 +1825,10 @@ contline:
return offset;
}
-int git_config_set_in_file(const char *config_filename,
- const char *key, const char *value)
+int git_config_set_in_file_gently(const char *config_filename,
+ const char *key, const char *value)
{
- return git_config_set_multivar_in_file(config_filename, key, value, NULL, 0);
+ return git_config_set_multivar_in_file_gently(config_filename, key, value, NULL, 0);
}
void git_config_set_in_file_or_die(const char *config_filename,
@@ -1837,9 +1837,9 @@ void git_config_set_in_file_or_die(const char *config_filename,
git_config_set_multivar_in_file_or_die(config_filename, key, value, NULL, 0);
}
-int git_config_set(const char *key, const char *value)
+int git_config_set_gently(const char *key, const char *value)
{
- return git_config_set_multivar(key, value, NULL, 0);
+ return git_config_set_multivar_gently(key, value, NULL, 0);
}
void git_config_set_or_die(const char *key, const char *value)
@@ -1961,9 +1961,10 @@ int git_config_key_is_valid(const char *key)
* - the config file is removed and the lock file rename()d to it.
*
*/
-int git_config_set_multivar_in_file(const char *config_filename,
- const char *key, const char *value,
- const char *value_regex, int multi_replace)
+int git_config_set_multivar_in_file_gently(const char *config_filename,
+ const char *key, const char *value,
+ const char *value_regex,
+ int multi_replace)
{
int fd = -1, in_fd = -1;
int ret;
@@ -2194,16 +2195,16 @@ void git_config_set_multivar_in_file_or_die(const char *config_filename,
const char *key, const char *value,
const char *value_regex, int multi_replace)
{
- if (git_config_set_multivar_in_file(config_filename, key, value,
- value_regex, multi_replace) < 0)
+ if (git_config_set_multivar_in_file_gently(config_filename, key, value,
+ value_regex, multi_replace) < 0)
die(_("Could not set '%s' to '%s'"), key, value);
}
-int git_config_set_multivar(const char *key, const char *value,
- const char *value_regex, int multi_replace)
+int git_config_set_multivar_gently(const char *key, const char *value,
+ const char *value_regex, int multi_replace)
{
- return git_config_set_multivar_in_file(NULL, key, value, value_regex,
- multi_replace);
+ return git_config_set_multivar_in_file_gently(NULL, key, value, value_regex,
+ multi_replace);
}
void git_config_set_multivar_or_die(const char *key, const char *value,