summaryrefslogtreecommitdiff
path: root/src/refspec.c
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-03-07 00:02:55 +0100
committerVicent Martí <tanoku@gmail.com>2012-03-07 00:11:43 +0100
commitcb8a79617b15e347f26d21cedde0f2b8670c1876 (patch)
tree459706192f41bbf15496f0c9bfe2e21b16a7e70b /src/refspec.c
parent9d160ba85539bbc593369f597a07d42c2770dff4 (diff)
downloadlibgit2-cb8a79617b15e347f26d21cedde0f2b8670c1876.tar.gz
error-handling: Repository
This also includes droping `git_buf_lasterror` because it makes no sense in the new system. Note that in most of the places were it has been dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so instead it should return a generic `-1` and obviously not throw anything.
Diffstat (limited to 'src/refspec.c')
-rw-r--r--src/refspec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/refspec.c b/src/refspec.c
index a27141431..d51fd4ceb 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -97,7 +97,7 @@ int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, con
int git_refspec_transform_r(git_buf *out, const git_refspec *spec, const char *name)
{
if (git_buf_sets(out, spec->dst) < GIT_SUCCESS)
- return git_buf_lasterror(out);
+ return GIT_ENOMEM;
/*
* No '*' at the end means that it's mapped to one specific local
@@ -109,5 +109,9 @@ int git_refspec_transform_r(git_buf *out, const git_refspec *spec, const char *n
git_buf_truncate(out, out->size - 1); /* remove trailing '*' */
git_buf_puts(out, name + strlen(spec->src) - 1);
- return git_buf_lasterror(out);
+ if (git_buf_oom(out))
+ return GIT_ENOMEM;
+
+ return 0;
}
+