diff options
| author | Russell Belfer <rb@github.com> | 2014-02-27 14:13:22 -0800 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2014-02-27 14:13:22 -0800 |
| commit | 6789b7a75d1e24a7f4ce34628c6b4561517f0b73 (patch) | |
| tree | 74ca53d8808a16090bb4df867b38c4a07444f8e1 /src/diff_file.h | |
| parent | d88399922f622baef91c6f4e4e67b2091653cb65 (diff) | |
| download | libgit2-6789b7a75d1e24a7f4ce34628c6b4561517f0b73.tar.gz | |
Add buffer to buffer diff and patch APIs
This adds `git_diff_buffers` and `git_patch_from_buffers`. This
also includes a bunch of internal refactoring to increase the
shared code between these functions and the blob-to-blob and
blob-to-buffer APIs, as well as some higher level assert helpers
in the tests to also remove redundancy.
Diffstat (limited to 'src/diff_file.h')
| -rw-r--r-- | src/diff_file.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/diff_file.h b/src/diff_file.h index 84bf255aa..4d290ad43 100644 --- a/src/diff_file.h +++ b/src/diff_file.h @@ -31,19 +31,21 @@ extern int git_diff_file_content__init_from_diff( size_t delta_index, bool use_old); -extern int git_diff_file_content__init_from_blob( - git_diff_file_content *fc, - git_repository *repo, - const git_diff_options *opts, - const git_blob *blob, - git_diff_file *as_file); +typedef struct { + const git_blob *blob; + const void *buf; + size_t buflen; + const char *as_path; +} git_diff_file_content_src; + +#define GIT_DIFF_FILE_CONTENT_SRC__BLOB(BLOB,PATH) { (BLOB),NULL,0,(PATH) } +#define GIT_DIFF_FILE_CONTENT_SRC__BUF(BUF,LEN,PATH) { NULL,(BUF),(LEN),(PATH) } -extern int git_diff_file_content__init_from_raw( +extern int git_diff_file_content__init_from_src( git_diff_file_content *fc, git_repository *repo, const git_diff_options *opts, - const char *buf, - size_t buflen, + const git_diff_file_content_src *src, git_diff_file *as_file); /* this loads the blob/file-on-disk as needed */ |
