]> git.proxmox.com Git - libgit2.git/blob - src/diff_file.h
Add buffer to buffer diff and patch APIs
[libgit2.git] / src / diff_file.h
1 /*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7 #ifndef INCLUDE_diff_file_h__
8 #define INCLUDE_diff_file_h__
9
10 #include "common.h"
11 #include "diff.h"
12 #include "diff_driver.h"
13 #include "map.h"
14
15 /* expanded information for one side of a delta */
16 typedef struct {
17 git_repository *repo;
18 git_diff_file *file;
19 git_diff_driver *driver;
20 uint32_t flags;
21 uint32_t opts_flags;
22 git_off_t opts_max_size;
23 git_iterator_type_t src;
24 const git_blob *blob;
25 git_map map;
26 } git_diff_file_content;
27
28 extern int git_diff_file_content__init_from_diff(
29 git_diff_file_content *fc,
30 git_diff *diff,
31 size_t delta_index,
32 bool use_old);
33
34 typedef struct {
35 const git_blob *blob;
36 const void *buf;
37 size_t buflen;
38 const char *as_path;
39 } git_diff_file_content_src;
40
41 #define GIT_DIFF_FILE_CONTENT_SRC__BLOB(BLOB,PATH) { (BLOB),NULL,0,(PATH) }
42 #define GIT_DIFF_FILE_CONTENT_SRC__BUF(BUF,LEN,PATH) { NULL,(BUF),(LEN),(PATH) }
43
44 extern int git_diff_file_content__init_from_src(
45 git_diff_file_content *fc,
46 git_repository *repo,
47 const git_diff_options *opts,
48 const git_diff_file_content_src *src,
49 git_diff_file *as_file);
50
51 /* this loads the blob/file-on-disk as needed */
52 extern int git_diff_file_content__load(git_diff_file_content *fc);
53
54 /* this releases the blob/file-in-memory */
55 extern void git_diff_file_content__unload(git_diff_file_content *fc);
56
57 /* this unloads and also releases any other resources */
58 extern void git_diff_file_content__clear(git_diff_file_content *fc);
59
60 #endif