]> git.proxmox.com Git - libgit2.git/blob - src/libgit2/diff_file.h
New upstream version 1.5.0+ds
[libgit2.git] / src / libgit2 / 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
12 #include "diff.h"
13 #include "diff_driver.h"
14 #include "map.h"
15
16 /* expanded information for one side of a delta */
17 typedef struct {
18 git_repository *repo;
19 git_diff_file *file;
20 git_diff_driver *driver;
21 uint32_t flags;
22 uint32_t opts_flags;
23 git_object_size_t opts_max_size;
24 git_iterator_t src;
25 const git_blob *blob;
26 git_map map;
27 } git_diff_file_content;
28
29 extern int git_diff_file_content__init_from_diff(
30 git_diff_file_content *fc,
31 git_diff *diff,
32 git_diff_delta *delta,
33 bool use_old);
34
35 typedef struct {
36 const git_blob *blob;
37 const void *buf;
38 size_t buflen;
39 const char *as_path;
40 } git_diff_file_content_src;
41
42 #define GIT_DIFF_FILE_CONTENT_SRC__BLOB(BLOB,PATH) { (BLOB),NULL,0,(PATH) }
43 #define GIT_DIFF_FILE_CONTENT_SRC__BUF(BUF,LEN,PATH) { NULL,(BUF),(LEN),(PATH) }
44
45 extern int git_diff_file_content__init_from_src(
46 git_diff_file_content *fc,
47 git_repository *repo,
48 const git_diff_options *opts,
49 const git_diff_file_content_src *src,
50 git_diff_file *as_file);
51
52 /* this loads the blob/file-on-disk as needed */
53 extern int git_diff_file_content__load(
54 git_diff_file_content *fc,
55 git_diff_options *diff_opts);
56
57 /* this releases the blob/file-in-memory */
58 extern void git_diff_file_content__unload(git_diff_file_content *fc);
59
60 /* this unloads and also releases any other resources */
61 extern void git_diff_file_content__clear(git_diff_file_content *fc);
62
63 #endif