summaryrefslogtreecommitdiff
path: root/src/remote.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-10-02 14:36:59 +0200
committernulltoken <emeric.fermas@gmail.com>2012-10-25 17:42:34 +0200
commitfb39b3a54cfedd1e414dc86f6ff5f9af9190c97b (patch)
tree22a78d38e8c289cf94f065b8dd873819c96f31b5 /src/remote.c
parent4fe5520a10eba1509d41daa4bacf3da9a8580d9b (diff)
downloadlibgit2-fb39b3a54cfedd1e414dc86f6ff5f9af9190c97b.tar.gz
refspec: introduce git_refspec__serialize()
Diffstat (limited to 'src/remote.c')
-rw-r--r--src/remote.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/remote.c b/src/remote.c
index 1e1cc3883..3506d5f08 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -237,17 +237,14 @@ static int update_config_refspec(
if (refspec->src == NULL || refspec->dst == NULL)
return 0;
- git_buf_printf(
+ if (git_buf_printf(
&name,
"remote.%s.%s",
remote_name,
- git_direction == GIT_DIR_FETCH ? "fetch" : "push");
+ git_direction == GIT_DIR_FETCH ? "fetch" : "push") < 0)
+ goto cleanup;
- if (refspec->force)
- git_buf_putc(&value, '+');
- git_buf_printf(&value, "%s:%s", refspec->src, refspec->dst);
-
- if (git_buf_oom(&name) || git_buf_oom(&value))
+ if (git_refspec__serialize(&value, refspec) < 0)
goto cleanup;
error = git_config_set_string(