rugged 0.24.6.1 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/ext/rugged/extconf.rb +9 -2
- data/ext/rugged/rugged.c +85 -21
- data/ext/rugged/rugged.h +7 -21
- data/ext/rugged/rugged_backend.c +3 -20
- data/ext/rugged/rugged_blame.c +7 -24
- data/ext/rugged/rugged_blob.c +136 -59
- data/ext/rugged/rugged_branch.c +3 -20
- data/ext/rugged/rugged_branch_collection.c +3 -20
- data/ext/rugged/rugged_commit.c +251 -101
- data/ext/rugged/rugged_config.c +3 -20
- data/ext/rugged/rugged_cred.c +3 -20
- data/ext/rugged/rugged_diff.c +3 -20
- data/ext/rugged/rugged_diff_delta.c +3 -20
- data/ext/rugged/rugged_diff_hunk.c +3 -20
- data/ext/rugged/rugged_diff_line.c +3 -20
- data/ext/rugged/rugged_index.c +46 -229
- data/ext/rugged/rugged_note.c +3 -20
- data/ext/rugged/rugged_object.c +3 -20
- data/ext/rugged/rugged_patch.c +192 -34
- data/ext/rugged/rugged_rebase.c +90 -48
- data/ext/rugged/rugged_reference.c +4 -21
- data/ext/rugged/rugged_reference_collection.c +3 -20
- data/ext/rugged/rugged_remote.c +70 -42
- data/ext/rugged/rugged_remote_collection.c +3 -20
- data/ext/rugged/rugged_repo.c +50 -59
- data/ext/rugged/rugged_revwalk.c +4 -21
- data/ext/rugged/rugged_settings.c +3 -20
- data/ext/rugged/rugged_signature.c +3 -20
- data/ext/rugged/rugged_submodule.c +4 -21
- data/ext/rugged/rugged_submodule_collection.c +3 -20
- data/ext/rugged/rugged_tag.c +3 -20
- data/ext/rugged/rugged_tag_collection.c +3 -20
- data/ext/rugged/rugged_tree.c +189 -184
- data/lib/rugged/attributes.rb +5 -0
- data/lib/rugged/blob.rb +5 -0
- data/lib/rugged/branch.rb +6 -1
- data/lib/rugged/commit.rb +5 -0
- data/lib/rugged/console.rb +5 -0
- data/lib/rugged/credentials.rb +5 -0
- data/lib/rugged/diff/delta.rb +5 -0
- data/lib/rugged/diff/hunk.rb +5 -0
- data/lib/rugged/diff/line.rb +5 -0
- data/lib/rugged/diff.rb +5 -0
- data/lib/rugged/index.rb +120 -0
- data/lib/rugged/object.rb +5 -0
- data/lib/rugged/patch.rb +5 -0
- data/lib/rugged/reference.rb +5 -0
- data/lib/rugged/remote.rb +5 -0
- data/lib/rugged/repository.rb +9 -4
- data/lib/rugged/submodule_collection.rb +5 -0
- data/lib/rugged/tag.rb +5 -0
- data/lib/rugged/tree.rb +156 -1
- data/lib/rugged/version.rb +6 -1
- data/lib/rugged/walker.rb +5 -0
- data/lib/rugged.rb +5 -0
- data/vendor/libgit2/CMakeLists.txt +12 -2
- data/vendor/libgit2/include/git2/blob.h +39 -28
- data/vendor/libgit2/include/git2/commit.h +76 -0
- data/vendor/libgit2/include/git2/common.h +21 -1
- data/vendor/libgit2/include/git2/describe.h +5 -2
- data/vendor/libgit2/include/git2/diff.h +62 -7
- data/vendor/libgit2/include/git2/errors.h +2 -1
- data/vendor/libgit2/include/git2/index.h +25 -0
- data/vendor/libgit2/include/git2/merge.h +10 -1
- data/vendor/libgit2/include/git2/odb.h +47 -1
- data/vendor/libgit2/include/git2/pack.h +4 -4
- data/vendor/libgit2/include/git2/patch.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +92 -0
- data/vendor/libgit2/include/git2/refs.h +11 -0
- data/vendor/libgit2/include/git2/remote.h +21 -8
- data/vendor/libgit2/include/git2/repository.h +20 -1
- data/vendor/libgit2/include/git2/revwalk.h +4 -6
- data/vendor/libgit2/include/git2/signature.h +13 -0
- data/vendor/libgit2/include/git2/submodule.h +11 -3
- data/vendor/libgit2/include/git2/sys/merge.h +177 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +11 -0
- data/vendor/libgit2/include/git2/sys/remote.h +16 -0
- data/vendor/libgit2/include/git2/sys/stream.h +2 -1
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +3 -1
- data/vendor/libgit2/include/git2/tag.h +9 -0
- data/vendor/libgit2/include/git2/transaction.h +9 -0
- data/vendor/libgit2/include/git2/tree.h +55 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/annotated_commit.c +99 -80
- data/vendor/libgit2/src/annotated_commit.h +5 -2
- data/vendor/libgit2/src/apply.c +377 -0
- data/vendor/libgit2/src/apply.h +21 -0
- data/vendor/libgit2/src/array.h +0 -1
- data/vendor/libgit2/src/blob.c +71 -39
- data/vendor/libgit2/src/branch.c +7 -5
- data/vendor/libgit2/src/buffer.c +252 -20
- data/vendor/libgit2/src/buffer.h +8 -0
- data/vendor/libgit2/src/checkout.c +69 -42
- data/vendor/libgit2/src/clone.c +0 -8
- data/vendor/libgit2/src/commit.c +193 -49
- data/vendor/libgit2/src/commit_list.c +8 -3
- data/vendor/libgit2/src/commit_list.h +1 -0
- data/vendor/libgit2/src/common.h +2 -1
- data/vendor/libgit2/src/config.c +3 -3
- data/vendor/libgit2/src/config_file.c +20 -10
- data/vendor/libgit2/src/crlf.c +1 -0
- data/vendor/libgit2/src/curl_stream.c +106 -6
- data/vendor/libgit2/src/delta.c +238 -62
- data/vendor/libgit2/src/delta.h +79 -58
- data/vendor/libgit2/src/describe.c +1 -1
- data/vendor/libgit2/src/diff.c +32 -1554
- data/vendor/libgit2/src/diff.h +14 -122
- data/vendor/libgit2/src/diff_driver.c +4 -6
- data/vendor/libgit2/src/diff_file.c +3 -0
- data/vendor/libgit2/src/diff_generate.c +1613 -0
- data/vendor/libgit2/src/diff_generate.h +123 -0
- data/vendor/libgit2/src/diff_parse.c +101 -0
- data/vendor/libgit2/src/diff_parse.h +18 -0
- data/vendor/libgit2/src/diff_print.c +263 -144
- data/vendor/libgit2/src/diff_stats.c +21 -12
- data/vendor/libgit2/src/diff_tform.c +1 -0
- data/vendor/libgit2/src/diff_tform.h +22 -0
- data/vendor/libgit2/src/diff_xdiff.c +9 -9
- data/vendor/libgit2/src/diff_xdiff.h +5 -5
- data/vendor/libgit2/src/fetchhead.c +8 -8
- data/vendor/libgit2/src/filebuf.c +6 -1
- data/vendor/libgit2/src/filebuf.h +1 -0
- data/vendor/libgit2/src/fileops.c +22 -1
- data/vendor/libgit2/src/fileops.h +8 -2
- data/vendor/libgit2/src/fnmatch.c +18 -5
- data/vendor/libgit2/src/global.c +21 -4
- data/vendor/libgit2/src/global.h +6 -0
- data/vendor/libgit2/src/graph.c +1 -1
- data/vendor/libgit2/src/index.c +159 -46
- data/vendor/libgit2/src/index.h +2 -0
- data/vendor/libgit2/src/iterator.c +1573 -1468
- data/vendor/libgit2/src/iterator.h +52 -69
- data/vendor/libgit2/src/merge.c +163 -64
- data/vendor/libgit2/src/merge.h +61 -2
- data/vendor/libgit2/src/merge_driver.c +397 -0
- data/vendor/libgit2/src/merge_driver.h +60 -0
- data/vendor/libgit2/src/merge_file.c +11 -49
- data/vendor/libgit2/src/netops.c +12 -10
- data/vendor/libgit2/src/object_api.c +19 -1
- data/vendor/libgit2/src/odb.c +228 -52
- data/vendor/libgit2/src/odb_loose.c +19 -1
- data/vendor/libgit2/src/odb_mempack.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +27 -1
- data/vendor/libgit2/src/openssl_stream.c +4 -5
- data/vendor/libgit2/src/pack-objects.c +105 -76
- data/vendor/libgit2/src/pack-objects.h +13 -12
- data/vendor/libgit2/src/pack.c +16 -10
- data/vendor/libgit2/src/pack.h +2 -0
- data/vendor/libgit2/src/patch.c +216 -0
- data/vendor/libgit2/src/patch.h +66 -0
- data/vendor/libgit2/src/{diff_patch.c → patch_generate.c} +203 -376
- data/vendor/libgit2/src/patch_generate.h +68 -0
- data/vendor/libgit2/src/patch_parse.c +1159 -0
- data/vendor/libgit2/src/patch_parse.h +56 -0
- data/vendor/libgit2/src/path.c +38 -2
- data/vendor/libgit2/src/path.h +18 -0
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/pool.h +5 -0
- data/vendor/libgit2/src/pqueue.c +12 -5
- data/vendor/libgit2/src/pqueue.h +1 -0
- data/vendor/libgit2/src/proxy.c +32 -0
- data/vendor/libgit2/src/proxy.h +14 -0
- data/vendor/libgit2/src/push.c +1 -1
- data/vendor/libgit2/src/rebase.c +63 -36
- data/vendor/libgit2/src/refdb.c +4 -2
- data/vendor/libgit2/src/refdb_fs.c +82 -54
- data/vendor/libgit2/src/refs.c +13 -1
- data/vendor/libgit2/src/remote.c +20 -81
- data/vendor/libgit2/src/repository.c +212 -29
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revparse.c +1 -1
- data/vendor/libgit2/src/revwalk.c +260 -184
- data/vendor/libgit2/src/settings.c +11 -3
- data/vendor/libgit2/src/signature.c +27 -2
- data/vendor/libgit2/src/sortedcache.c +14 -5
- data/vendor/libgit2/src/stash.c +1 -0
- data/vendor/libgit2/src/status.c +1 -0
- data/vendor/libgit2/src/stransport_stream.c +4 -2
- data/vendor/libgit2/src/stream.h +2 -2
- data/vendor/libgit2/src/submodule.c +16 -4
- data/vendor/libgit2/src/sysdir.c +1 -1
- data/vendor/libgit2/src/transport.c +3 -5
- data/vendor/libgit2/src/transports/http.c +38 -13
- data/vendor/libgit2/src/transports/local.c +4 -1
- data/vendor/libgit2/src/transports/smart.c +6 -0
- data/vendor/libgit2/src/transports/smart.h +1 -0
- data/vendor/libgit2/src/transports/smart_pkt.c +5 -13
- data/vendor/libgit2/src/transports/smart_protocol.c +22 -7
- data/vendor/libgit2/src/transports/winhttp.c +144 -11
- data/vendor/libgit2/src/tree.c +267 -2
- data/vendor/libgit2/src/unix/posix.h +10 -0
- data/vendor/libgit2/src/unix/pthread.h +2 -0
- data/vendor/libgit2/src/util.c +25 -2
- data/vendor/libgit2/src/util.h +10 -0
- data/vendor/libgit2/src/varint.c +44 -0
- data/vendor/libgit2/src/varint.h +15 -0
- data/vendor/libgit2/src/vector.c +58 -0
- data/vendor/libgit2/src/vector.h +8 -0
- data/vendor/libgit2/src/win32/posix.h +3 -0
- data/vendor/libgit2/src/win32/thread.c +18 -0
- data/vendor/libgit2/src/win32/thread.h +2 -0
- data/vendor/libgit2/src/win32/w32_util.h +1 -1
- data/vendor/libgit2/src/zstream.c +37 -8
- data/vendor/libgit2/src/zstream.h +8 -1
- metadata +100 -82
- data/vendor/libgit2/Makefile.embed +0 -60
- data/vendor/libgit2/src/delta-apply.c +0 -166
- data/vendor/libgit2/src/delta-apply.h +0 -62
- data/vendor/libgit2/src/diff_patch.h +0 -83
@@ -1,166 +0,0 @@
|
|
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
|
-
#include "common.h"
|
8
|
-
#include "git2/odb.h"
|
9
|
-
#include "delta-apply.h"
|
10
|
-
|
11
|
-
/*
|
12
|
-
* This file was heavily cribbed from BinaryDelta.java in JGit, which
|
13
|
-
* itself was heavily cribbed from <code>patch-delta.c</code> in the
|
14
|
-
* GIT project. The original delta patching code was written by
|
15
|
-
* Nicolas Pitre <nico@cam.org>.
|
16
|
-
*/
|
17
|
-
|
18
|
-
static int hdr_sz(
|
19
|
-
size_t *size,
|
20
|
-
const unsigned char **delta,
|
21
|
-
const unsigned char *end)
|
22
|
-
{
|
23
|
-
const unsigned char *d = *delta;
|
24
|
-
size_t r = 0;
|
25
|
-
unsigned int c, shift = 0;
|
26
|
-
|
27
|
-
do {
|
28
|
-
if (d == end)
|
29
|
-
return -1;
|
30
|
-
c = *d++;
|
31
|
-
r |= (c & 0x7f) << shift;
|
32
|
-
shift += 7;
|
33
|
-
} while (c & 0x80);
|
34
|
-
*delta = d;
|
35
|
-
*size = r;
|
36
|
-
return 0;
|
37
|
-
}
|
38
|
-
|
39
|
-
int git__delta_read_header(
|
40
|
-
const unsigned char *delta,
|
41
|
-
size_t delta_len,
|
42
|
-
size_t *base_sz,
|
43
|
-
size_t *res_sz)
|
44
|
-
{
|
45
|
-
const unsigned char *delta_end = delta + delta_len;
|
46
|
-
if ((hdr_sz(base_sz, &delta, delta_end) < 0) ||
|
47
|
-
(hdr_sz(res_sz, &delta, delta_end) < 0))
|
48
|
-
return -1;
|
49
|
-
return 0;
|
50
|
-
}
|
51
|
-
|
52
|
-
#define DELTA_HEADER_BUFFER_LEN 16
|
53
|
-
int git__delta_read_header_fromstream(size_t *base_sz, size_t *res_sz, git_packfile_stream *stream)
|
54
|
-
{
|
55
|
-
static const size_t buffer_len = DELTA_HEADER_BUFFER_LEN;
|
56
|
-
unsigned char buffer[DELTA_HEADER_BUFFER_LEN];
|
57
|
-
const unsigned char *delta, *delta_end;
|
58
|
-
size_t len;
|
59
|
-
ssize_t read;
|
60
|
-
|
61
|
-
len = read = 0;
|
62
|
-
while (len < buffer_len) {
|
63
|
-
read = git_packfile_stream_read(stream, &buffer[len], buffer_len - len);
|
64
|
-
|
65
|
-
if (read == 0)
|
66
|
-
break;
|
67
|
-
|
68
|
-
if (read == GIT_EBUFS)
|
69
|
-
continue;
|
70
|
-
|
71
|
-
len += read;
|
72
|
-
}
|
73
|
-
|
74
|
-
delta = buffer;
|
75
|
-
delta_end = delta + len;
|
76
|
-
if ((hdr_sz(base_sz, &delta, delta_end) < 0) ||
|
77
|
-
(hdr_sz(res_sz, &delta, delta_end) < 0))
|
78
|
-
return -1;
|
79
|
-
|
80
|
-
return 0;
|
81
|
-
}
|
82
|
-
|
83
|
-
int git__delta_apply(
|
84
|
-
git_rawobj *out,
|
85
|
-
const unsigned char *base,
|
86
|
-
size_t base_len,
|
87
|
-
const unsigned char *delta,
|
88
|
-
size_t delta_len)
|
89
|
-
{
|
90
|
-
const unsigned char *delta_end = delta + delta_len;
|
91
|
-
size_t base_sz, res_sz, alloc_sz;
|
92
|
-
unsigned char *res_dp;
|
93
|
-
|
94
|
-
/* Check that the base size matches the data we were given;
|
95
|
-
* if not we would underflow while accessing data from the
|
96
|
-
* base object, resulting in data corruption or segfault.
|
97
|
-
*/
|
98
|
-
if ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) {
|
99
|
-
giterr_set(GITERR_INVALID, "Failed to apply delta. Base size does not match given data");
|
100
|
-
return -1;
|
101
|
-
}
|
102
|
-
|
103
|
-
if (hdr_sz(&res_sz, &delta, delta_end) < 0) {
|
104
|
-
giterr_set(GITERR_INVALID, "Failed to apply delta. Base size does not match given data");
|
105
|
-
return -1;
|
106
|
-
}
|
107
|
-
|
108
|
-
GITERR_CHECK_ALLOC_ADD(&alloc_sz, res_sz, 1);
|
109
|
-
res_dp = git__malloc(alloc_sz);
|
110
|
-
GITERR_CHECK_ALLOC(res_dp);
|
111
|
-
|
112
|
-
res_dp[res_sz] = '\0';
|
113
|
-
out->data = res_dp;
|
114
|
-
out->len = res_sz;
|
115
|
-
|
116
|
-
while (delta < delta_end) {
|
117
|
-
unsigned char cmd = *delta++;
|
118
|
-
if (cmd & 0x80) {
|
119
|
-
/* cmd is a copy instruction; copy from the base.
|
120
|
-
*/
|
121
|
-
size_t off = 0, len = 0;
|
122
|
-
|
123
|
-
if (cmd & 0x01) off = *delta++;
|
124
|
-
if (cmd & 0x02) off |= *delta++ << 8UL;
|
125
|
-
if (cmd & 0x04) off |= *delta++ << 16UL;
|
126
|
-
if (cmd & 0x08) off |= *delta++ << 24UL;
|
127
|
-
|
128
|
-
if (cmd & 0x10) len = *delta++;
|
129
|
-
if (cmd & 0x20) len |= *delta++ << 8UL;
|
130
|
-
if (cmd & 0x40) len |= *delta++ << 16UL;
|
131
|
-
if (!len) len = 0x10000;
|
132
|
-
|
133
|
-
if (base_len < off + len || res_sz < len)
|
134
|
-
goto fail;
|
135
|
-
memcpy(res_dp, base + off, len);
|
136
|
-
res_dp += len;
|
137
|
-
res_sz -= len;
|
138
|
-
|
139
|
-
} else if (cmd) {
|
140
|
-
/* cmd is a literal insert instruction; copy from
|
141
|
-
* the delta stream itself.
|
142
|
-
*/
|
143
|
-
if (delta_end - delta < cmd || res_sz < cmd)
|
144
|
-
goto fail;
|
145
|
-
memcpy(res_dp, delta, cmd);
|
146
|
-
delta += cmd;
|
147
|
-
res_dp += cmd;
|
148
|
-
res_sz -= cmd;
|
149
|
-
|
150
|
-
} else {
|
151
|
-
/* cmd == 0 is reserved for future encodings.
|
152
|
-
*/
|
153
|
-
goto fail;
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
if (delta != delta_end || res_sz)
|
158
|
-
goto fail;
|
159
|
-
return 0;
|
160
|
-
|
161
|
-
fail:
|
162
|
-
git__free(out->data);
|
163
|
-
out->data = NULL;
|
164
|
-
giterr_set(GITERR_INVALID, "Failed to apply delta");
|
165
|
-
return -1;
|
166
|
-
}
|
@@ -1,62 +0,0 @@
|
|
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_delta_apply_h__
|
8
|
-
#define INCLUDE_delta_apply_h__
|
9
|
-
|
10
|
-
#include "odb.h"
|
11
|
-
#include "pack.h"
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Apply a git binary delta to recover the original content.
|
15
|
-
*
|
16
|
-
* @param out the output buffer to receive the original data.
|
17
|
-
* Only out->data and out->len are populated, as this is
|
18
|
-
* the only information available in the delta.
|
19
|
-
* @param base the base to copy from during copy instructions.
|
20
|
-
* @param base_len number of bytes available at base.
|
21
|
-
* @param delta the delta to execute copy/insert instructions from.
|
22
|
-
* @param delta_len total number of bytes in the delta.
|
23
|
-
* @return
|
24
|
-
* - 0 on a successful delta unpack.
|
25
|
-
* - GIT_ERROR if the delta is corrupt or doesn't match the base.
|
26
|
-
*/
|
27
|
-
extern int git__delta_apply(
|
28
|
-
git_rawobj *out,
|
29
|
-
const unsigned char *base,
|
30
|
-
size_t base_len,
|
31
|
-
const unsigned char *delta,
|
32
|
-
size_t delta_len);
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Read the header of a git binary delta.
|
36
|
-
*
|
37
|
-
* @param delta the delta to execute copy/insert instructions from.
|
38
|
-
* @param delta_len total number of bytes in the delta.
|
39
|
-
* @param base_sz pointer to store the base size field.
|
40
|
-
* @param res_sz pointer to store the result size field.
|
41
|
-
* @return
|
42
|
-
* - 0 on a successful decoding the header.
|
43
|
-
* - GIT_ERROR if the delta is corrupt.
|
44
|
-
*/
|
45
|
-
extern int git__delta_read_header(
|
46
|
-
const unsigned char *delta,
|
47
|
-
size_t delta_len,
|
48
|
-
size_t *base_sz,
|
49
|
-
size_t *res_sz);
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Read the header of a git binary delta
|
53
|
-
*
|
54
|
-
* This variant reads just enough from the packfile stream to read the
|
55
|
-
* delta header.
|
56
|
-
*/
|
57
|
-
extern int git__delta_read_header_fromstream(
|
58
|
-
size_t *base_sz,
|
59
|
-
size_t *res_sz,
|
60
|
-
git_packfile_stream *stream);
|
61
|
-
|
62
|
-
#endif
|
@@ -1,83 +0,0 @@
|
|
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_patch_h__
|
8
|
-
#define INCLUDE_diff_patch_h__
|
9
|
-
|
10
|
-
#include "common.h"
|
11
|
-
#include "diff.h"
|
12
|
-
#include "diff_file.h"
|
13
|
-
#include "array.h"
|
14
|
-
#include "git2/patch.h"
|
15
|
-
|
16
|
-
/* cached information about a hunk in a diff */
|
17
|
-
typedef struct diff_patch_hunk {
|
18
|
-
git_diff_hunk hunk;
|
19
|
-
size_t line_start;
|
20
|
-
size_t line_count;
|
21
|
-
} diff_patch_hunk;
|
22
|
-
|
23
|
-
enum {
|
24
|
-
GIT_DIFF_PATCH_ALLOCATED = (1 << 0),
|
25
|
-
GIT_DIFF_PATCH_INITIALIZED = (1 << 1),
|
26
|
-
GIT_DIFF_PATCH_LOADED = (1 << 2),
|
27
|
-
/* the two sides are different */
|
28
|
-
GIT_DIFF_PATCH_DIFFABLE = (1 << 3),
|
29
|
-
/* the difference between the two sides has been computed */
|
30
|
-
GIT_DIFF_PATCH_DIFFED = (1 << 4),
|
31
|
-
GIT_DIFF_PATCH_FLATTENED = (1 << 5),
|
32
|
-
};
|
33
|
-
|
34
|
-
struct git_patch {
|
35
|
-
git_refcount rc;
|
36
|
-
git_diff *diff; /* for refcount purposes, maybe NULL for blob diffs */
|
37
|
-
git_diff_options diff_opts;
|
38
|
-
git_diff_delta *delta;
|
39
|
-
size_t delta_index;
|
40
|
-
git_diff_file_content ofile;
|
41
|
-
git_diff_file_content nfile;
|
42
|
-
uint32_t flags;
|
43
|
-
git_diff_binary binary;
|
44
|
-
git_array_t(diff_patch_hunk) hunks;
|
45
|
-
git_array_t(git_diff_line) lines;
|
46
|
-
size_t content_size, context_size, header_size;
|
47
|
-
git_pool flattened;
|
48
|
-
};
|
49
|
-
|
50
|
-
extern git_diff *git_patch__diff(git_patch *);
|
51
|
-
|
52
|
-
extern git_diff_driver *git_patch__driver(git_patch *);
|
53
|
-
|
54
|
-
extern void git_patch__old_data(char **, size_t *, git_patch *);
|
55
|
-
extern void git_patch__new_data(char **, size_t *, git_patch *);
|
56
|
-
|
57
|
-
extern int git_patch__invoke_callbacks(
|
58
|
-
git_patch *patch,
|
59
|
-
git_diff_file_cb file_cb,
|
60
|
-
git_diff_binary_cb binary_cb,
|
61
|
-
git_diff_hunk_cb hunk_cb,
|
62
|
-
git_diff_line_cb line_cb,
|
63
|
-
void *payload);
|
64
|
-
|
65
|
-
typedef struct git_diff_output git_diff_output;
|
66
|
-
struct git_diff_output {
|
67
|
-
/* these callbacks are issued with the diff data */
|
68
|
-
git_diff_file_cb file_cb;
|
69
|
-
git_diff_binary_cb binary_cb;
|
70
|
-
git_diff_hunk_cb hunk_cb;
|
71
|
-
git_diff_line_cb data_cb;
|
72
|
-
void *payload;
|
73
|
-
|
74
|
-
/* this records the actual error in cases where it may be obscured */
|
75
|
-
int error;
|
76
|
-
|
77
|
-
/* this callback is used to do the diff and drive the other callbacks.
|
78
|
-
* see diff_xdiff.h for how to use this in practice for now.
|
79
|
-
*/
|
80
|
-
int (*diff_cb)(git_diff_output *output, git_patch *patch);
|
81
|
-
};
|
82
|
-
|
83
|
-
#endif
|