]>
Commit | Line | Data |
---|---|---|
114f5a6c RB |
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; | |
74ded024 | 18 | git_diff_file *file; |
114f5a6c | 19 | git_diff_driver *driver; |
74ded024 | 20 | uint32_t flags; |
5dc98298 RB |
21 | uint32_t opts_flags; |
22 | git_off_t opts_max_size; | |
114f5a6c RB |
23 | git_iterator_type_t src; |
24 | const git_blob *blob; | |
25 | git_map map; | |
26 | } git_diff_file_content; | |
27 | ||
360f42f4 | 28 | extern int git_diff_file_content__init_from_diff( |
114f5a6c | 29 | git_diff_file_content *fc, |
3ff1d123 | 30 | git_diff *diff, |
8147b1af | 31 | git_diff_delta *delta, |
114f5a6c RB |
32 | bool use_old); |
33 | ||
6789b7a7 RB |
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) } | |
114f5a6c | 43 | |
6789b7a7 | 44 | extern int git_diff_file_content__init_from_src( |
114f5a6c RB |
45 | git_diff_file_content *fc, |
46 | git_repository *repo, | |
47 | const git_diff_options *opts, | |
6789b7a7 | 48 | const git_diff_file_content_src *src, |
74ded024 | 49 | git_diff_file *as_file); |
114f5a6c RB |
50 | |
51 | /* this loads the blob/file-on-disk as needed */ | |
8147b1af ET |
52 | extern int git_diff_file_content__load( |
53 | git_diff_file_content *fc, | |
54 | git_diff_options *diff_opts); | |
114f5a6c RB |
55 | |
56 | /* this releases the blob/file-in-memory */ | |
360f42f4 | 57 | extern void git_diff_file_content__unload(git_diff_file_content *fc); |
114f5a6c RB |
58 | |
59 | /* this unloads and also releases any other resources */ | |
360f42f4 | 60 | extern void git_diff_file_content__clear(git_diff_file_content *fc); |
114f5a6c RB |
61 | |
62 | #endif |