check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1]);
return git_config_set_multivar_in_file(given_config_source.file,
- argv[0], value, "^$", 0);
+ argv[0], value, "a^", 0);
}
else if (actions == ACTION_REPLACE_ALL) {
check_write();
return !strcmp(key, store.key) &&
(store.value_regex == NULL ||
(store.do_not_match ^
- !regexec(store.value_regex, value, 0, NULL, 0)));
+ (value && !regexec(store.value_regex, value, 0, NULL, 0))));
}
static int store_aux(const char *key, const char *value, void *cb)
test_must_fail git config section.key
'
+test_expect_success '--add appends new value after existing empty value' '
+ cat >expect <<-\EOF &&
+
+
+ fool
+ roll
+ EOF
+ cp .git/config .git/config.old &&
+ test_when_finished "mv .git/config.old .git/config" &&
+ cat >.git/config <<-\EOF &&
+ [foo]
+ baz
+ baz =
+ baz = fool
+ EOF
+ git config --add foo.baz roll &&
+ git config --get-all foo.baz >output &&
+ test_cmp expect output
+'
+
test_done