diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-05-14 09:35:08 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-05-17 15:45:37 +0200 |
| commit | 70f7484d2ae7ed4b5c4d074aa5e9f99ebeebdd77 (patch) | |
| tree | 0098c6694312776cfea0ba73ee3243ae3c634718 /src | |
| parent | 7b5ce2e5c43db345590c8702b669325df59c8524 (diff) | |
| download | libgit2-70f7484d2ae7ed4b5c4d074aa5e9f99ebeebdd77.tar.gz | |
remote: get rid of the run-time refspec setters
These were left over from the culling as it's not clear which use-cases
might benefit from this. It is not clear that we want to support any
use-case which depends on changing the remote's idea of the base
refspecs rather than passing in different per-operation refspec list, so
remove these functions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/remote.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/remote.c b/src/remote.c index 44885bd17..c561ecdb5 100644 --- a/src/remote.c +++ b/src/remote.c @@ -318,8 +318,9 @@ int git_remote_create_anonymous(git_remote **out, git_repository *repo, const ch int git_remote_dup(git_remote **dest, git_remote *source) { + size_t i; int error = 0; - git_strarray refspecs = { 0 }; + git_refspec *spec; git_remote *remote = git__calloc(1, sizeof(git_remote)); GITERR_CHECK_ALLOC(remote); @@ -349,22 +350,15 @@ int git_remote_dup(git_remote **dest, git_remote *source) goto cleanup; } - if ((error = git_remote_get_fetch_refspecs(&refspecs, source)) < 0 || - (error = git_remote_set_fetch_refspecs(remote, &refspecs)) < 0) - goto cleanup; - - git_strarray_free(&refspecs); - - if ((error = git_remote_get_push_refspecs(&refspecs, source)) < 0 || - (error = git_remote_set_push_refspecs(remote, &refspecs)) < 0) - goto cleanup; + git_vector_foreach(&source->refspecs, i, spec) { + if ((error = add_refspec(remote, spec->string, !spec->push)) < 0) + goto cleanup; + } *dest = remote; cleanup: - git_strarray_free(&refspecs); - if (error < 0) git__free(remote); @@ -2046,16 +2040,6 @@ static int set_refspecs(git_remote *remote, git_strarray *array, int push) return 0; } -int git_remote_set_fetch_refspecs(git_remote *remote, git_strarray *array) -{ - return set_refspecs(remote, array, false); -} - -int git_remote_set_push_refspecs(git_remote *remote, git_strarray *array) -{ - return set_refspecs(remote, array, true); -} - static int copy_refspecs(git_strarray *array, const git_remote *remote, unsigned int push) { size_t i; |
