summaryrefslogtreecommitdiff
path: root/src/clone.c
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2013-04-23 12:28:59 -0700
committerBen Straub <bs@github.com>2013-04-23 12:28:59 -0700
commitbd0a07f4bb0b83a84127589f7385eb2309910b66 (patch)
tree19ecda9ac464999a22cd7a1e186a73c567d430c6 /src/clone.c
parent495d6f07c44c48e9968eb82f65c3336ba1922398 (diff)
downloadlibgit2-bd0a07f4bb0b83a84127589f7385eb2309910b66.tar.gz
Clone: replace fetch spec with custom value
Diffstat (limited to 'src/clone.c')
-rw-r--r--src/clone.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/clone.c b/src/clone.c
index 8f10ca819..0665576e3 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -323,9 +323,11 @@ static int create_and_configure_origin(
(error = git_remote_set_callbacks(origin, options->remote_callbacks)) < 0)
goto on_error;
- if (options->fetch_spec &&
- (error = git_remote_add_fetch(origin, options->fetch_spec)) < 0)
- goto on_error;
+ if (options->fetch_spec) {
+ git_remote_clear_refspecs(origin);
+ if ((error = git_remote_add_fetch(origin, options->fetch_spec)) < 0)
+ goto on_error;
+ }
if (options->push_spec &&
(error = git_remote_add_push(origin, options->push_spec)) < 0)