summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/refspec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/refspec.c b/src/refspec.c
index fa60aa7a..48d34cd9 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -209,11 +209,21 @@ static int refspec_transform(
int git_refspec_transform(git_buf *out, const git_refspec *spec, const char *name)
{
+ git_buf_sanitize(out);
+
+ if (!spec->pattern)
+ return git_buf_puts(out, spec->dst);
+
return refspec_transform(out, spec->src, spec->dst, name);
}
int git_refspec_rtransform(git_buf *out, const git_refspec *spec, const char *name)
{
+ git_buf_sanitize(out);
+
+ if (!spec->pattern)
+ return git_buf_puts(out, spec->src);
+
return refspec_transform(out, spec->dst, spec->src, name);
}