mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 05:01:54 +00:00
Use git_blob__getbuf.
This commit is contained in:
parent
71bc89b9b6
commit
41ad70d0a8
@ -19,6 +19,7 @@
|
|||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "repository.h"
|
#include "repository.h"
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
|
#include "blob.h"
|
||||||
|
|
||||||
GIT_BEGIN_DECL
|
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)
|
static int unfiltered_blob_contents(git_buf *out, git_repository *repo, const git_oid *blob_id)
|
||||||
{
|
{
|
||||||
int retcode = GIT_ERROR;
|
int retcode = GIT_ERROR;
|
||||||
|
|
||||||
git_blob *blob;
|
git_blob *blob;
|
||||||
if (!git_blob_lookup(&blob, repo, blob_id)) {
|
|
||||||
const void *contents = git_blob_rawcontent(blob);
|
if (!(retcode = git_blob_lookup(&blob, repo, blob_id)))
|
||||||
size_t len = git_blob_rawsize(blob);
|
retcode = git_blob__getbuf(out, blob);
|
||||||
git_buf_clear(out);
|
|
||||||
git_buf_set(out, (const char*)contents, len);
|
|
||||||
git_blob_free(blob);
|
|
||||||
retcode = 0;
|
|
||||||
}
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user