]> git.proxmox.com Git - libgit2.git/blame - src/libgit2/diff_file.h
New upstream version 1.5.0+ds
[libgit2.git] / src / libgit2 / diff_file.h
CommitLineData
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"
eae0bfdc 11
114f5a6c
RB
12#include "diff.h"
13#include "diff_driver.h"
14#include "map.h"
15
16/* expanded information for one side of a delta */
17typedef struct {
18 git_repository *repo;
74ded024 19 git_diff_file *file;
114f5a6c 20 git_diff_driver *driver;
74ded024 21 uint32_t flags;
5dc98298 22 uint32_t opts_flags;
22a2d3d5
UG
23 git_object_size_t opts_max_size;
24 git_iterator_t src;
114f5a6c
RB
25 const git_blob *blob;
26 git_map map;
27} git_diff_file_content;
28
360f42f4 29extern int git_diff_file_content__init_from_diff(
114f5a6c 30 git_diff_file_content *fc,
3ff1d123 31 git_diff *diff,
8147b1af 32 git_diff_delta *delta,
114f5a6c
RB
33 bool use_old);
34
6789b7a7
RB
35typedef 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) }
114f5a6c 44
6789b7a7 45extern int git_diff_file_content__init_from_src(
114f5a6c
RB
46 git_diff_file_content *fc,
47 git_repository *repo,
48 const git_diff_options *opts,
6789b7a7 49 const git_diff_file_content_src *src,
74ded024 50 git_diff_file *as_file);
114f5a6c
RB
51
52/* this loads the blob/file-on-disk as needed */
8147b1af
ET
53extern int git_diff_file_content__load(
54 git_diff_file_content *fc,
55 git_diff_options *diff_opts);
114f5a6c
RB
56
57/* this releases the blob/file-in-memory */
360f42f4 58extern void git_diff_file_content__unload(git_diff_file_content *fc);
114f5a6c
RB
59
60/* this unloads and also releases any other resources */
360f42f4 61extern void git_diff_file_content__clear(git_diff_file_content *fc);
114f5a6c
RB
62
63#endif