libgit2

git_blob_create_fromchunks

Version:

Write a loose blob to the Object Database from a provider of chunks of data.

Provided the hintpath parameter is filled, its value will help to determine what git filters should be applied to the object before it can be placed to the object database.

The implementation of the callback has to respect the following rules:

  • content will have to be filled by the consumer. The maximum number of bytes that the buffer can accept per call is defined by the max_length parameter. Allocation and freeing of the buffer will be taken care of by the function.
  • The callback is expected to return the number of bytes that content have been filled with.
  • When there is no more data to stream, the callback should return 0. This will prevent it from being invoked anymore.
  • When an error occurs, the callback should return -1.

Signature

int git_blob_create_fromchunks(git_oid *id, git_repository *repo, const char *hintpath, git_blob_chunk_cb callback, void *payload);

Parameters

In
id

Return the id of the written blob

In
repo

repository where the blob will be written. This repository can be bare or not.

const char *
In
hintpath

if not NULL, will help selecting the filters to apply onto the content of the blob to be created.

In
callback
void *
In
payload

Returns

int

0 or an error code

Versions