diff options
author | Ben Straub <bstraub@github.com> | 2012-07-16 11:32:24 -0700 |
---|---|---|
committer | Ben Straub <bstraub@github.com> | 2012-07-16 11:32:24 -0700 |
commit | 41ad70d0a8d5bf294197be5da26411bc7aa33fcc (patch) | |
tree | d785865766dd97e7f9e0f7a47c220b468a388775 /src | |
parent | 71bc89b9b6e15469115c667972a0f710e0ae4e7d (diff) | |
download | libgit2-41ad70d0a8d5bf294197be5da26411bc7aa33fcc.tar.gz |
Use git_blob__getbuf.
Diffstat (limited to 'src')
-rw-r--r-- | src/checkout.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/checkout.c b/src/checkout.c index 1e02935ab..61e81c538 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -19,6 +19,7 @@ #include "buffer.h" #include "repository.h" #include "filter.h" +#include "blob.h" GIT_BEGIN_DECL @@ -34,16 +35,11 @@ typedef struct tree_walk_data static int unfiltered_blob_contents(git_buf *out, git_repository *repo, const git_oid *blob_id) { int retcode = GIT_ERROR; - git_blob *blob; - if (!git_blob_lookup(&blob, repo, blob_id)) { - const void *contents = git_blob_rawcontent(blob); - size_t len = git_blob_rawsize(blob); - git_buf_clear(out); - git_buf_set(out, (const char*)contents, len); - git_blob_free(blob); - retcode = 0; - } + + if (!(retcode = git_blob_lookup(&blob, repo, blob_id))) + retcode = git_blob__getbuf(out, blob); + return retcode; } |