]>
Commit | Line | Data |
---|---|---|
65b09b1d | 1 | /* |
359fc2d2 | 2 | * Copyright (C) the libgit2 contributors. All rights reserved. |
65b09b1d RB |
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_h__ | |
8 | #define INCLUDE_diff_h__ | |
9 | ||
eae0bfdc PP |
10 | #include "common.h" |
11 | ||
5f69a31f | 12 | #include "git2/diff.h" |
b859faa6 | 13 | #include "git2/patch.h" |
9c8ed499 | 14 | #include "git2/sys/diff.h" |
5f69a31f RB |
15 | #include "git2/oid.h" |
16 | ||
65b09b1d RB |
17 | #include <stdio.h> |
18 | #include "vector.h" | |
19 | #include "buffer.h" | |
74fa4bfa RB |
20 | #include "iterator.h" |
21 | #include "repository.h" | |
19fa2bc1 | 22 | #include "pool.h" |
effdbeb3 | 23 | #include "odb.h" |
65b09b1d | 24 | |
16b83019 RB |
25 | #define DIFF_OLD_PREFIX_DEFAULT "a/" |
26 | #define DIFF_NEW_PREFIX_DEFAULT "b/" | |
eb3d71a5 | 27 | |
9be638ec ET |
28 | typedef enum { |
29 | GIT_DIFF_TYPE_UNKNOWN = 0, | |
30 | GIT_DIFF_TYPE_GENERATED = 1, | |
7166bb16 | 31 | GIT_DIFF_TYPE_PARSED = 2, |
9be638ec | 32 | } git_diff_origin_t; |
67db583d | 33 | |
3ff1d123 | 34 | struct git_diff { |
f335ecd6 | 35 | git_refcount rc; |
65b09b1d | 36 | git_repository *repo; |
eae0bfdc | 37 | git_attr_session attrsession; |
9be638ec | 38 | git_diff_origin_t type; |
65b09b1d | 39 | git_diff_options opts; |
52a61bb8 | 40 | git_vector deltas; /* vector of git_diff_delta */ |
19fa2bc1 | 41 | git_pool pool; |
0c9c969a UG |
42 | git_iterator_t old_src; |
43 | git_iterator_t new_src; | |
9c8ed499 | 44 | git_diff_perfdata perf; |
55cbd05b | 45 | |
0f3def71 RB |
46 | int (*strcomp)(const char *, const char *); |
47 | int (*strncomp)(const char *, const char *, size_t); | |
48 | int (*pfxcomp)(const char *str, const char *pfx); | |
49 | int (*entrycomp)(const void *a, const void *b); | |
b36effa2 | 50 | |
b859faa6 | 51 | int (*patch_fn)(git_patch **out, git_diff *diff, size_t idx); |
9be638ec ET |
52 | void (*free_fn)(git_diff *diff); |
53 | }; | |
64286308 | 54 | |
197b8966 RB |
55 | extern int git_diff_delta__format_file_header( |
56 | git_buf *out, | |
57 | const git_diff_delta *delta, | |
58 | const char *oldpfx, | |
59 | const char *newpfx, | |
0c9c969a UG |
60 | int oid_strlen, |
61 | bool print_index); | |
197b8966 | 62 | |
9be638ec ET |
63 | extern int git_diff_delta__cmp(const void *a, const void *b); |
64 | extern int git_diff_delta__casecmp(const void *a, const void *b); | |
effdbeb3 | 65 | |
7166bb16 ET |
66 | extern int git_diff__entry_cmp(const void *a, const void *b); |
67 | extern int git_diff__entry_icmp(const void *a, const void *b); | |
68 | ||
65b09b1d | 69 | #endif |