diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-05-05 09:22:35 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-22 17:02:55 +0200 |
| commit | d6073b30f38f95aa25b1545cccac38261b359de1 (patch) | |
| tree | 7a5a84001d63bf1574913757a01c50b14ac85aab /src/submodule.c | |
| parent | 486ba4cdd3d30c202d0c7ed202d6122a7e2b5164 (diff) | |
| download | libgit2-d6073b30f38f95aa25b1545cccac38261b359de1.tar.gz | |
submodule: make `_set_url()` affect the configuration
With this one, we can get rid of the edit_and_save test.
Diffstat (limited to 'src/submodule.c')
| -rw-r--r-- | src/submodule.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/submodule.c b/src/submodule.c index 3ad5d3eb3..24d31fe77 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -788,10 +788,6 @@ int git_submodule_save(git_submodule *submodule) (error = git_config_file_set_string(mods, key.ptr, submodule->path)) < 0) goto cleanup; - if ((error = submodule_config_key_trunc_puts(&key, "url")) < 0 || - (error = git_config_file_set_string(mods, key.ptr, submodule->url)) < 0) - goto cleanup; - /* update internal defaults */ submodule->ignore_default = submodule->ignore; @@ -890,16 +886,11 @@ int git_submodule_set_branch(git_repository *repo, const char *name, const char return write_var(repo, name, "branch", branch); } -int git_submodule_set_url(git_submodule *submodule, const char *url) +int git_submodule_set_url(git_repository *repo, const char *name, const char *url) { - assert(submodule && url); - - git__free(submodule->url); + assert(repo && name && url); - submodule->url = git__strdup(url); - GITERR_CHECK_ALLOC(submodule->url); - - return 0; + return write_var(repo, name, "url", url); } const git_oid *git_submodule_index_id(git_submodule *submodule) |
