Some missing oid to id renames
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
diff --git a/include/git2/blob.h b/include/git2/blob.h
index 6ba5e9f..ac4d843 100644
--- a/include/git2/blob.h
+++ b/include/git2/blob.h
@@ -196,13 +196,14 @@ GIT_EXTERN(int) git_blob_create_fromchunks(
/**
* 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 buffer data to be written into the blob
* @param len length of the data
* @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.
diff --git a/src/blob.c b/src/blob.c
index 2e924f3..faf8a4a 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -50,25 +50,28 @@ int git_blob__parse(void *blob, git_odb_object *odb_obj)
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;
git_odb *odb;
git_odb_stream *stream;
+ assert(id && repo);
+
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
(error = git_odb_open_wstream(&stream, odb, len, GIT_OBJ_BLOB)) < 0)
return error;
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);
return error;
}
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;
char buffer[4096];
@@ -97,14 +100,14 @@ static int write_file_stream(
}
if (!error)
- error = git_odb_stream_finalize_write(oid, stream);
+ error = git_odb_stream_finalize_write(id, stream);
git_odb_stream_free(stream);
return error;
}
static int write_file_filtered(
- git_oid *oid,
+ git_oid *id,
git_off_t *size,
git_odb *odb,
const char *full_path,
@@ -119,7 +122,7 @@ static int write_file_filtered(
if (!error) {
*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);
@@ -127,7 +130,7 @@ static int write_file_filtered(
}
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;
ssize_t read_len;
@@ -143,13 +146,13 @@ static int write_symlink(
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);
return error;
}
int git_blob__create_from_paths(
- git_oid *oid,
+ git_oid *id,
struct stat *out_st,
git_repository *repo,
const char *content_path,
@@ -188,7 +191,7 @@ int git_blob__create_from_paths(
mode = hint_mode ? hint_mode : st.st_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 {
git_filter_list *fl = NULL;
@@ -202,10 +205,10 @@ int git_blob__create_from_paths(
else if (fl == NULL)
/* No filters need to be applied to the document: we can stream
* directly from disk */
- error = write_file_stream(oid, odb, content_path, size);
+ error = write_file_stream(id, odb, content_path, size);
else {
/* 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);
}
@@ -233,13 +236,13 @@ done:
}
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(
- git_oid *oid, git_repository *repo, const char *path)
+ git_oid *id, git_repository *repo, const char *path)
{
int error;
git_buf full_path = GIT_BUF_INIT;
@@ -257,7 +260,7 @@ int git_blob_create_fromdisk(
hintpath += strlen(workdir);
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);
return error;
@@ -266,7 +269,7 @@ int git_blob_create_fromdisk(
#define BUFFER_SIZE 4096
int git_blob_create_fromchunks(
- git_oid *oid,
+ git_oid *id,
git_repository *repo,
const char *hintpath,
int (*source_cb)(char *content, size_t max_length, void *payload),
@@ -277,7 +280,7 @@ int git_blob_create_fromchunks(
git_filebuf file = GIT_FILEBUF_INIT;
git_buf path = GIT_BUF_INIT;
- assert(oid && repo && source_cb);
+ assert(id && repo && source_cb);
if ((error = git_buf_joinpath(
&path, git_repository_path(repo), GIT_OBJECTS_DIR "streamed")) < 0)
@@ -313,7 +316,7 @@ int git_blob_create_fromchunks(
goto cleanup;
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:
git_buf_free(&path);