summaryrefslogtreecommitdiff
path: root/src/config_file.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-08-02 13:00:58 -0700
committerRussell Belfer <rb@github.com>2012-08-24 11:00:26 -0700
commitaa13bf05c84f10f364ce35c5d4f989337b36e043 (patch)
treeca5877bd006a6bfdcd9aad5587e36e89523d6cd2 /src/config_file.c
parentdecff7b4c13939e5f00d51aea4176fc543d73ede (diff)
downloadlibgit2-aa13bf05c84f10f364ce35c5d4f989337b36e043.tar.gz
Major submodule rewrite
This replaces the old submodule API with a new extended API that supports most of the things that can be done with `git submodule`.
Diffstat (limited to 'src/config_file.c')
-rw-r--r--src/config_file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 547509b9f..aabb21f16 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -253,11 +253,17 @@ static int config_set(git_config_file *cfg, const char *name, const char *value)
char *tmp = NULL;
git__free(key);
+
if (existing->next != NULL) {
giterr_set(GITERR_CONFIG, "Multivar incompatible with simple set");
return -1;
}
+ /* don't update if old and new values already match */
+ if ((!existing->value && !value) ||
+ (existing->value && value && !strcmp(existing->value, value)))
+ return 0;
+
if (value) {
tmp = git__strdup(value);
GITERR_CHECK_ALLOC(tmp);