diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2019-06-08 17:46:04 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-06-16 00:16:49 +0100 |
| commit | 08f392080cfd7e08972820d8147dc06432e7c4bf (patch) | |
| tree | 14fe06510232924fc5e164d979a32980216104a0 /src | |
| parent | 5d92e54745eaad2c89aa6457d504411ceee3a4f4 (diff) | |
| download | libgit2-08f392080cfd7e08972820d8147dc06432e7c4bf.tar.gz | |
blob: add underscore to `from` functions
The majority of functions are named `from_something` (with an
underscore) instead of `fromsomething`. Update the blob functions for
consistency with the rest of the library.
Diffstat (limited to 'src')
| -rw-r--r-- | src/apply.c | 2 | ||||
| -rw-r--r-- | src/blob.c | 43 | ||||
| -rw-r--r-- | src/index.c | 2 | ||||
| -rw-r--r-- | src/notes.c | 2 |
4 files changed, 41 insertions, 8 deletions
diff --git a/src/apply.c b/src/apply.c index fdafa662e..f876e437e 100644 --- a/src/apply.c +++ b/src/apply.c @@ -532,7 +532,7 @@ static int apply_one( if (delta->status != GIT_DELTA_DELETED) { if ((error = git_apply__patch(&post_contents, &filename, &mode, pre_contents.ptr, pre_contents.size, patch, opts)) < 0 || - (error = git_blob_create_frombuffer(&post_id, repo, + (error = git_blob_create_from_buffer(&post_id, repo, post_contents.ptr, post_contents.size)) < 0) goto done; diff --git a/src/blob.c b/src/blob.c index 566d24b8e..31e6ccf86 100644 --- a/src/blob.c +++ b/src/blob.c @@ -70,7 +70,7 @@ int git_blob__parse(void *_blob, git_odb_object *odb_obj) return 0; } -int git_blob_create_frombuffer( +int git_blob_create_from_buffer( git_oid *id, git_repository *repo, const void *buffer, size_t len) { int error; @@ -263,13 +263,13 @@ done: return error; } -int git_blob_create_fromworkdir( +int git_blob_create_from_workdir( git_oid *id, git_repository *repo, const char *path) { return git_blob__create_from_paths(id, NULL, repo, NULL, path, 0, true); } -int git_blob_create_fromdisk( +int git_blob_create_from_disk( git_oid *id, git_repository *repo, const char *path) { int error; @@ -325,7 +325,7 @@ static int blob_writestream_write(git_writestream *_stream, const char *buffer, return git_filebuf_write(&stream->fbuf, buffer, len); } -int git_blob_create_fromstream(git_writestream **out, git_repository *repo, const char *hintpath) +int git_blob_create_from_stream(git_writestream **out, git_repository *repo, const char *hintpath) { int error; git_buf path = GIT_BUF_INIT; @@ -364,7 +364,7 @@ cleanup: return error; } -int git_blob_create_fromstream_commit(git_oid *out, git_writestream *_stream) +int git_blob_create_from_stream_commit(git_oid *out, git_writestream *_stream) { int error; blob_writestream *stream = (blob_writestream *) _stream; @@ -427,3 +427,36 @@ int git_blob_filtered_content( return error; } + +/* Deprecated functions */ + +int git_blob_create_frombuffer( + git_oid *id, git_repository *repo, const void *buffer, size_t len) +{ + return git_blob_create_from_buffer(id, repo, buffer, len); +} + +int git_blob_create_fromworkdir(git_oid *id, git_repository *repo, const char *relative_path) +{ + return git_blob_create_from_workdir(id, repo, relative_path); +} + +int git_blob_create_fromdisk(git_oid *id, git_repository *repo, const char *path) +{ + return git_blob_create_from_disk(id, repo, path); +} + +int git_blob_create_fromstream( + git_writestream **out, + git_repository *repo, + const char *hintpath) +{ + return git_blob_create_from_stream(out, repo, hintpath); +} + +int git_blob_create_fromstream_commit( + git_oid *out, + git_writestream *stream) +{ + return git_blob_create_from_stream_commit(out, stream); +} diff --git a/src/index.c b/src/index.c index ee8dfd541..ec4343377 100644 --- a/src/index.c +++ b/src/index.c @@ -1477,7 +1477,7 @@ int git_index_add_frombuffer( if (index_entry_dup(&entry, index, source_entry) < 0) return -1; - error = git_blob_create_frombuffer(&id, INDEX_OWNER(index), buffer, len); + error = git_blob_create_from_buffer(&id, INDEX_OWNER(index), buffer, len); if (error < 0) { index_entry_free(entry); return error; diff --git a/src/notes.c b/src/notes.c index 8e622c64a..5028107d2 100644 --- a/src/notes.c +++ b/src/notes.c @@ -288,7 +288,7 @@ static int note_write( /* TODO: should we apply filters? */ /* create note object */ - if ((error = git_blob_create_frombuffer(&oid, repo, note, strlen(note))) < 0) + if ((error = git_blob_create_from_buffer(&oid, repo, note, strlen(note))) < 0) goto cleanup; if ((error = manipulate_note_in_tree_r( |
