diff options
| author | Daniel Rodríguez Troitiño <drodrigueztroitino@yahoo.es> | 2013-10-31 01:08:50 +0100 |
|---|---|---|
| committer | Daniel Rodríguez Troitiño <drodrigueztroitino@yahoo.es> | 2013-11-01 00:08:52 +0100 |
| commit | 3793fa9b181f3595c24a1cc517646f8e7a4a7175 (patch) | |
| tree | bb78115b16c217afa41257af7ea4af12ad23896b /include/git2/sys/config.h | |
| parent | f93f3790c511d3ed821bf63fdaf5aeec155e195b (diff) | |
| download | libgit2-3793fa9b181f3595c24a1cc517646f8e7a4a7175.tar.gz | |
Fix saving remotes with several fetch/push ref specs.
At some moment git_config_delete_entry lost the ability to delete one entry of
a multivar configuration. The moment you had more than one fetch or push
ref spec for a remote you will not be able to save that remote anymore. The
changes in network::remote::remotes::save show that problem.
I needed to create a new git_config_delete_multivar because I was not able to
remove one or several entries of a multivar config with the current API.
Several tries modifying how git_config_set_multivar(..., NULL) behaved were
not successful.
git_config_delete_multivar is very similar to git_config_set_multivar, and
delegates into config_delete_multivar of config_file. This function search
for the cvar_t that will be deleted, storing them in a temporal array, and
rebuilding the linked list. After calling config_write to delete the entries,
the cvar_t stored in the temporal array are freed.
There is a little fix in config_write, it avoids an infinite loop when using
a regular expression (case for the multivars). This error was found by the
test network::remote::remotes::tagopt.
Diffstat (limited to 'include/git2/sys/config.h')
| -rw-r--r-- | include/git2/sys/config.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/git2/sys/config.h b/include/git2/sys/config.h index 7572ace51..419ad7ea7 100644 --- a/include/git2/sys/config.h +++ b/include/git2/sys/config.h @@ -61,6 +61,7 @@ struct git_config_backend { int (*set)(struct git_config_backend *, const char *key, const char *value); int (*set_multivar)(git_config_backend *cfg, const char *name, const char *regexp, const char *value); int (*del)(struct git_config_backend *, const char *key); + int (*del_multivar)(struct git_config_backend *, const char *key, const char *regexp); int (*iterator)(git_config_iterator **, struct git_config_backend *); int (*refresh)(struct git_config_backend *); void (*free)(struct git_config_backend *); |
