mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 15:52:02 +00:00
refspec: short-circuit non-pattern refspecs on transform
When transforming a non-pattern refspec, we simply need to copy over the opposite string. Move that logic up to the wrapper so we can assume a pattern refspec in the transformation function.
This commit is contained in:
parent
98ce2318c8
commit
9ed104a8fa
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user