Commit 5572d2b8 by Russell Belfer

Some missing oid to id renames

parent 0316d80a
...@@ -196,13 +196,14 @@ GIT_EXTERN(int) git_blob_create_fromchunks( ...@@ -196,13 +196,14 @@ GIT_EXTERN(int) git_blob_create_fromchunks(
/** /**
* Write an in-memory buffer to the ODB as a blob * Write an in-memory buffer to the ODB as a blob
* *
* @param oid return the oid of the written blob * @param id return the id of the written blob
* @param repo repository where to blob will be written * @param repo repository where to blob will be written
* @param buffer data to be written into the blob * @param buffer data to be written into the blob
* @param len length of the data * @param len length of the data
* @return 0 or an error code * @return 0 or an error code
*/ */
GIT_EXTERN(int) git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const void *buffer, size_t len); GIT_EXTERN(int) git_blob_create_frombuffer(
git_oid *id, git_repository *repo, const void *buffer, size_t len);
/** /**
* Determine if the blob content is most certainly binary or not. * Determine if the blob content is most certainly binary or not.
......
...@@ -50,25 +50,28 @@ int git_blob__parse(void *blob, git_odb_object *odb_obj) ...@@ -50,25 +50,28 @@ int git_blob__parse(void *blob, git_odb_object *odb_obj)
return 0; return 0;
} }
int git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const void *buffer, size_t len) int git_blob_create_frombuffer(
git_oid *id, git_repository *repo, const void *buffer, size_t len)
{ {
int error; int error;
git_odb *odb; git_odb *odb;
git_odb_stream *stream; git_odb_stream *stream;
assert(id && repo);
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 || if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
(error = git_odb_open_wstream(&stream, odb, len, GIT_OBJ_BLOB)) < 0) (error = git_odb_open_wstream(&stream, odb, len, GIT_OBJ_BLOB)) < 0)
return error; return error;
if ((error = git_odb_stream_write(stream, buffer, len)) == 0) if ((error = git_odb_stream_write(stream, buffer, len)) == 0)
error = git_odb_stream_finalize_write(oid, stream); error = git_odb_stream_finalize_write(id, stream);
git_odb_stream_free(stream); git_odb_stream_free(stream);
return error; return error;
} }
static int write_file_stream( static int write_file_stream(
git_oid *oid, git_odb *odb, const char *path, git_off_t file_size) git_oid *id, git_odb *odb, const char *path, git_off_t file_size)
{ {
int fd, error; int fd, error;
char buffer[4096]; char buffer[4096];
...@@ -97,14 +100,14 @@ static int write_file_stream( ...@@ -97,14 +100,14 @@ static int write_file_stream(
} }
if (!error) if (!error)
error = git_odb_stream_finalize_write(oid, stream); error = git_odb_stream_finalize_write(id, stream);
git_odb_stream_free(stream); git_odb_stream_free(stream);
return error; return error;
} }
static int write_file_filtered( static int write_file_filtered(
git_oid *oid, git_oid *id,
git_off_t *size, git_off_t *size,
git_odb *odb, git_odb *odb,
const char *full_path, const char *full_path,
...@@ -119,7 +122,7 @@ static int write_file_filtered( ...@@ -119,7 +122,7 @@ static int write_file_filtered(
if (!error) { if (!error) {
*size = tgt.size; *size = tgt.size;
error = git_odb_write(oid, odb, tgt.ptr, tgt.size, GIT_OBJ_BLOB); error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJ_BLOB);
} }
git_buf_free(&tgt); git_buf_free(&tgt);
...@@ -127,7 +130,7 @@ static int write_file_filtered( ...@@ -127,7 +130,7 @@ static int write_file_filtered(
} }
static int write_symlink( static int write_symlink(
git_oid *oid, git_odb *odb, const char *path, size_t link_size) git_oid *id, git_odb *odb, const char *path, size_t link_size)
{ {
char *link_data; char *link_data;
ssize_t read_len; ssize_t read_len;
...@@ -143,13 +146,13 @@ static int write_symlink( ...@@ -143,13 +146,13 @@ static int write_symlink(
return -1; return -1;
} }
error = git_odb_write(oid, odb, (void *)link_data, link_size, GIT_OBJ_BLOB); error = git_odb_write(id, odb, (void *)link_data, link_size, GIT_OBJ_BLOB);
git__free(link_data); git__free(link_data);
return error; return error;
} }
int git_blob__create_from_paths( int git_blob__create_from_paths(
git_oid *oid, git_oid *id,
struct stat *out_st, struct stat *out_st,
git_repository *repo, git_repository *repo,
const char *content_path, const char *content_path,
...@@ -188,7 +191,7 @@ int git_blob__create_from_paths( ...@@ -188,7 +191,7 @@ int git_blob__create_from_paths(
mode = hint_mode ? hint_mode : st.st_mode; mode = hint_mode ? hint_mode : st.st_mode;
if (S_ISLNK(mode)) { if (S_ISLNK(mode)) {
error = write_symlink(oid, odb, content_path, (size_t)size); error = write_symlink(id, odb, content_path, (size_t)size);
} else { } else {
git_filter_list *fl = NULL; git_filter_list *fl = NULL;
...@@ -202,10 +205,10 @@ int git_blob__create_from_paths( ...@@ -202,10 +205,10 @@ int git_blob__create_from_paths(
else if (fl == NULL) else if (fl == NULL)
/* No filters need to be applied to the document: we can stream /* No filters need to be applied to the document: we can stream
* directly from disk */ * directly from disk */
error = write_file_stream(oid, odb, content_path, size); error = write_file_stream(id, odb, content_path, size);
else { else {
/* We need to apply one or more filters */ /* We need to apply one or more filters */
error = write_file_filtered(oid, &size, odb, content_path, fl); error = write_file_filtered(id, &size, odb, content_path, fl);
git_filter_list_free(fl); git_filter_list_free(fl);
} }
...@@ -233,13 +236,13 @@ done: ...@@ -233,13 +236,13 @@ done:
} }
int git_blob_create_fromworkdir( int git_blob_create_fromworkdir(
git_oid *oid, git_repository *repo, const char *path) git_oid *id, git_repository *repo, const char *path)
{ {
return git_blob__create_from_paths(oid, NULL, repo, NULL, path, 0, true); return git_blob__create_from_paths(id, NULL, repo, NULL, path, 0, true);
} }
int git_blob_create_fromdisk( int git_blob_create_fromdisk(
git_oid *oid, git_repository *repo, const char *path) git_oid *id, git_repository *repo, const char *path)
{ {
int error; int error;
git_buf full_path = GIT_BUF_INIT; git_buf full_path = GIT_BUF_INIT;
...@@ -257,7 +260,7 @@ int git_blob_create_fromdisk( ...@@ -257,7 +260,7 @@ int git_blob_create_fromdisk(
hintpath += strlen(workdir); hintpath += strlen(workdir);
error = git_blob__create_from_paths( error = git_blob__create_from_paths(
oid, NULL, repo, git_buf_cstr(&full_path), hintpath, 0, true); id, NULL, repo, git_buf_cstr(&full_path), hintpath, 0, true);
git_buf_free(&full_path); git_buf_free(&full_path);
return error; return error;
...@@ -266,7 +269,7 @@ int git_blob_create_fromdisk( ...@@ -266,7 +269,7 @@ int git_blob_create_fromdisk(
#define BUFFER_SIZE 4096 #define BUFFER_SIZE 4096
int git_blob_create_fromchunks( int git_blob_create_fromchunks(
git_oid *oid, git_oid *id,
git_repository *repo, git_repository *repo,
const char *hintpath, const char *hintpath,
int (*source_cb)(char *content, size_t max_length, void *payload), int (*source_cb)(char *content, size_t max_length, void *payload),
...@@ -277,7 +280,7 @@ int git_blob_create_fromchunks( ...@@ -277,7 +280,7 @@ int git_blob_create_fromchunks(
git_filebuf file = GIT_FILEBUF_INIT; git_filebuf file = GIT_FILEBUF_INIT;
git_buf path = GIT_BUF_INIT; git_buf path = GIT_BUF_INIT;
assert(oid && repo && source_cb); assert(id && repo && source_cb);
if ((error = git_buf_joinpath( if ((error = git_buf_joinpath(
&path, git_repository_path(repo), GIT_OBJECTS_DIR "streamed")) < 0) &path, git_repository_path(repo), GIT_OBJECTS_DIR "streamed")) < 0)
...@@ -313,7 +316,7 @@ int git_blob_create_fromchunks( ...@@ -313,7 +316,7 @@ int git_blob_create_fromchunks(
goto cleanup; goto cleanup;
error = git_blob__create_from_paths( error = git_blob__create_from_paths(
oid, NULL, repo, file.path_lock, hintpath, 0, hintpath != NULL); id, NULL, repo, file.path_lock, hintpath, 0, hintpath != NULL);
cleanup: cleanup:
git_buf_free(&path); git_buf_free(&path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment