summaryrefslogtreecommitdiff
path: root/src/refspec.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/refspec.c
parent4fe5520a10eba1509d41daa4bacf3da9a8580d9b (diff)
downloadlibgit2-fb39b3a54cfedd1e414dc86f6ff5f9af9190c97b.tar.gz
refspec: introduce git_refspec__serialize()
Diffstat (limited to 'src/refspec.c')
-rw-r--r--src/refspec.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/refspec.c b/src/refspec.c
index b1790b32c..8b69e9d8e 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -225,3 +225,14 @@ int git_refspec_transform_l(git_buf *out, const git_refspec *spec, const char *n
return refspec_transform(out, spec->dst, spec->src, name);
}
+int git_refspec__serialize(git_buf *out, const git_refspec *refspec)
+{
+ if (refspec->force)
+ git_buf_putc(out, '+');
+
+ git_buf_printf(out, "%s:%s",
+ refspec->src != NULL ? refspec->src : "",
+ refspec->dst != NULL ? refspec->dst : "");
+
+ return git_buf_oom(out) == false;
+}