line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#include "blame_git.h" |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include "commit.h" |
11
|
|
|
|
|
|
|
#include "blob.h" |
12
|
|
|
|
|
|
|
#include "xdiff/xinclude.h" |
13
|
|
|
|
|
|
|
#include "diff_xdiff.h" |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
/* |
16
|
|
|
|
|
|
|
* Origin is refcounted and usually we keep the blob contents to be |
17
|
|
|
|
|
|
|
* reused. |
18
|
|
|
|
|
|
|
*/ |
19
|
13
|
|
|
|
|
|
static git_blame__origin *origin_incref(git_blame__origin *o) |
20
|
|
|
|
|
|
|
{ |
21
|
13
|
50
|
|
|
|
|
if (o) |
22
|
13
|
|
|
|
|
|
o->refcnt++; |
23
|
13
|
|
|
|
|
|
return o; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
18
|
|
|
|
|
|
static void origin_decref(git_blame__origin *o) |
27
|
|
|
|
|
|
|
{ |
28
|
18
|
100
|
|
|
|
|
if (o && --o->refcnt <= 0) { |
|
|
100
|
|
|
|
|
|
29
|
3
|
100
|
|
|
|
|
if (o->previous) |
30
|
2
|
|
|
|
|
|
origin_decref(o->previous); |
31
|
3
|
|
|
|
|
|
git_blob_free(o->blob); |
32
|
3
|
|
|
|
|
|
git_commit_free(o->commit); |
33
|
3
|
|
|
|
|
|
git__free(o); |
34
|
|
|
|
|
|
|
} |
35
|
18
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
/* Given a commit and a path in it, create a new origin structure. */ |
38
|
4
|
|
|
|
|
|
static int make_origin(git_blame__origin **out, git_commit *commit, const char *path) |
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
git_blame__origin *o; |
41
|
|
|
|
|
|
|
git_object *blob; |
42
|
4
|
|
|
|
|
|
size_t path_len = strlen(path), alloc_len; |
43
|
4
|
|
|
|
|
|
int error = 0; |
44
|
|
|
|
|
|
|
|
45
|
4
|
100
|
|
|
|
|
if ((error = git_object_lookup_bypath(&blob, (git_object*)commit, |
46
|
|
|
|
|
|
|
path, GIT_OBJECT_BLOB)) < 0) |
47
|
1
|
|
|
|
|
|
return error; |
48
|
|
|
|
|
|
|
|
49
|
3
|
50
|
|
|
|
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*o), path_len); |
|
|
50
|
|
|
|
|
|
50
|
3
|
50
|
|
|
|
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1); |
|
|
50
|
|
|
|
|
|
51
|
3
|
|
|
|
|
|
o = git__calloc(1, alloc_len); |
52
|
3
|
50
|
|
|
|
|
GIT_ERROR_CHECK_ALLOC(o); |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
|
o->commit = commit; |
55
|
3
|
|
|
|
|
|
o->blob = (git_blob *) blob; |
56
|
3
|
|
|
|
|
|
o->refcnt = 1; |
57
|
3
|
|
|
|
|
|
strcpy(o->path, path); |
58
|
|
|
|
|
|
|
|
59
|
3
|
|
|
|
|
|
*out = o; |
60
|
|
|
|
|
|
|
|
61
|
4
|
|
|
|
|
|
return 0; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
/* Locate an existing origin or create a new one. */ |
65
|
1
|
|
|
|
|
|
int git_blame__get_origin( |
66
|
|
|
|
|
|
|
git_blame__origin **out, |
67
|
|
|
|
|
|
|
git_blame *blame, |
68
|
|
|
|
|
|
|
git_commit *commit, |
69
|
|
|
|
|
|
|
const char *path) |
70
|
|
|
|
|
|
|
{ |
71
|
|
|
|
|
|
|
git_blame__entry *e; |
72
|
|
|
|
|
|
|
|
73
|
1
|
50
|
|
|
|
|
for (e = blame->ent; e; e = e->next) { |
74
|
0
|
0
|
|
|
|
|
if (e->suspect->commit == commit && !strcmp(e->suspect->path, path)) { |
|
|
0
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
*out = origin_incref(e->suspect); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
1
|
|
|
|
|
|
return make_origin(out, commit, path); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
typedef struct blame_chunk_cb_data { |
82
|
|
|
|
|
|
|
git_blame *blame; |
83
|
|
|
|
|
|
|
git_blame__origin *target; |
84
|
|
|
|
|
|
|
git_blame__origin *parent; |
85
|
|
|
|
|
|
|
long tlno; |
86
|
|
|
|
|
|
|
long plno; |
87
|
|
|
|
|
|
|
}blame_chunk_cb_data; |
88
|
|
|
|
|
|
|
|
89
|
20
|
|
|
|
|
|
static bool same_suspect(git_blame__origin *a, git_blame__origin *b) |
90
|
|
|
|
|
|
|
{ |
91
|
20
|
100
|
|
|
|
|
if (a == b) |
92
|
11
|
|
|
|
|
|
return true; |
93
|
9
|
50
|
|
|
|
|
if (git_oid_cmp(git_commit_id(a->commit), git_commit_id(b->commit))) |
94
|
9
|
|
|
|
|
|
return false; |
95
|
0
|
|
|
|
|
|
return 0 == strcmp(a->path, b->path); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
/* find the line number of the last line the target is suspected for */ |
99
|
2
|
|
|
|
|
|
static bool find_last_in_target(size_t *out, git_blame *blame, git_blame__origin *target) |
100
|
|
|
|
|
|
|
{ |
101
|
|
|
|
|
|
|
git_blame__entry *e; |
102
|
2
|
|
|
|
|
|
size_t last_in_target = 0; |
103
|
2
|
|
|
|
|
|
bool found = false; |
104
|
|
|
|
|
|
|
|
105
|
2
|
|
|
|
|
|
*out = 0; |
106
|
|
|
|
|
|
|
|
107
|
5
|
100
|
|
|
|
|
for (e=blame->ent; e; e=e->next) { |
108
|
3
|
100
|
|
|
|
|
if (e->guilty || !same_suspect(e->suspect, target)) |
|
|
50
|
|
|
|
|
|
109
|
1
|
|
|
|
|
|
continue; |
110
|
2
|
50
|
|
|
|
|
if (last_in_target < e->s_lno + e->num_lines) { |
111
|
2
|
|
|
|
|
|
found = true; |
112
|
2
|
|
|
|
|
|
last_in_target = e->s_lno + e->num_lines; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
2
|
|
|
|
|
|
*out = last_in_target; |
117
|
2
|
|
|
|
|
|
return found; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
/* |
121
|
|
|
|
|
|
|
* It is known that lines between tlno to same came from parent, and e |
122
|
|
|
|
|
|
|
* has an overlap with that range. it also is known that parent's |
123
|
|
|
|
|
|
|
* line plno corresponds to e's line tlno. |
124
|
|
|
|
|
|
|
* |
125
|
|
|
|
|
|
|
* <---- e -----> |
126
|
|
|
|
|
|
|
* <------> (entirely within) |
127
|
|
|
|
|
|
|
* <------------> (extends past) |
128
|
|
|
|
|
|
|
* <------------> (starts before) |
129
|
|
|
|
|
|
|
* <------------------> (entirely encloses) |
130
|
|
|
|
|
|
|
* |
131
|
|
|
|
|
|
|
* Split e into potentially three parts; before this chunk, the chunk |
132
|
|
|
|
|
|
|
* to be blamed for the parent, and after that portion. |
133
|
|
|
|
|
|
|
*/ |
134
|
2
|
|
|
|
|
|
static void split_overlap(git_blame__entry *split, git_blame__entry *e, |
135
|
|
|
|
|
|
|
size_t tlno, size_t plno, size_t same, git_blame__origin *parent) |
136
|
|
|
|
|
|
|
{ |
137
|
|
|
|
|
|
|
size_t chunk_end_lno; |
138
|
|
|
|
|
|
|
|
139
|
2
|
50
|
|
|
|
|
if (e->s_lno < tlno) { |
140
|
|
|
|
|
|
|
/* there is a pre-chunk part not blamed on the parent */ |
141
|
0
|
|
|
|
|
|
split[0].suspect = origin_incref(e->suspect); |
142
|
0
|
|
|
|
|
|
split[0].lno = e->lno; |
143
|
0
|
|
|
|
|
|
split[0].s_lno = e->s_lno; |
144
|
0
|
|
|
|
|
|
split[0].num_lines = tlno - e->s_lno; |
145
|
0
|
|
|
|
|
|
split[1].lno = e->lno + tlno - e->s_lno; |
146
|
0
|
|
|
|
|
|
split[1].s_lno = plno; |
147
|
|
|
|
|
|
|
} else { |
148
|
2
|
|
|
|
|
|
split[1].lno = e->lno; |
149
|
2
|
|
|
|
|
|
split[1].s_lno = plno + (e->s_lno - tlno); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
2
|
50
|
|
|
|
|
if (same < e->s_lno + e->num_lines) { |
153
|
|
|
|
|
|
|
/* there is a post-chunk part not blamed on parent */ |
154
|
2
|
|
|
|
|
|
split[2].suspect = origin_incref(e->suspect); |
155
|
2
|
|
|
|
|
|
split[2].lno = e->lno + (same - e->s_lno); |
156
|
2
|
|
|
|
|
|
split[2].s_lno = e->s_lno + (same - e->s_lno); |
157
|
2
|
|
|
|
|
|
split[2].num_lines = e->s_lno + e->num_lines - same; |
158
|
2
|
|
|
|
|
|
chunk_end_lno = split[2].lno; |
159
|
|
|
|
|
|
|
} else { |
160
|
0
|
|
|
|
|
|
chunk_end_lno = e->lno + e->num_lines; |
161
|
|
|
|
|
|
|
} |
162
|
2
|
|
|
|
|
|
split[1].num_lines = chunk_end_lno - split[1].lno; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
/* |
165
|
|
|
|
|
|
|
* if it turns out there is nothing to blame the parent for, forget about |
166
|
|
|
|
|
|
|
* the splitting. !split[1].suspect signals this. |
167
|
|
|
|
|
|
|
*/ |
168
|
2
|
50
|
|
|
|
|
if (split[1].num_lines < 1) |
169
|
0
|
|
|
|
|
|
return; |
170
|
2
|
|
|
|
|
|
split[1].suspect = origin_incref(parent); |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
/* |
174
|
|
|
|
|
|
|
* Link in a new blame entry to the scoreboard. Entries that cover the same |
175
|
|
|
|
|
|
|
* line range have been removed from the scoreboard previously. |
176
|
|
|
|
|
|
|
*/ |
177
|
2
|
|
|
|
|
|
static void add_blame_entry(git_blame *blame, git_blame__entry *e) |
178
|
|
|
|
|
|
|
{ |
179
|
2
|
|
|
|
|
|
git_blame__entry *ent, *prev = NULL; |
180
|
|
|
|
|
|
|
|
181
|
2
|
|
|
|
|
|
origin_incref(e->suspect); |
182
|
|
|
|
|
|
|
|
183
|
4
|
100
|
|
|
|
|
for (ent = blame->ent; ent && ent->lno < e->lno; ent = ent->next) |
|
|
100
|
|
|
|
|
|
184
|
2
|
|
|
|
|
|
prev = ent; |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
/* prev, if not NULL, is the last one that is below e */ |
187
|
2
|
|
|
|
|
|
e->prev = prev; |
188
|
2
|
50
|
|
|
|
|
if (prev) { |
189
|
2
|
|
|
|
|
|
e->next = prev->next; |
190
|
2
|
|
|
|
|
|
prev->next = e; |
191
|
|
|
|
|
|
|
} else { |
192
|
0
|
|
|
|
|
|
e->next = blame->ent; |
193
|
0
|
|
|
|
|
|
blame->ent = e; |
194
|
|
|
|
|
|
|
} |
195
|
2
|
100
|
|
|
|
|
if (e->next) |
196
|
1
|
|
|
|
|
|
e->next->prev = e; |
197
|
2
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
/* |
200
|
|
|
|
|
|
|
* src typically is on-stack; we want to copy the information in it to |
201
|
|
|
|
|
|
|
* a malloced blame_entry that is already on the linked list of the scoreboard. |
202
|
|
|
|
|
|
|
* The origin of dst loses a refcnt while the origin of src gains one. |
203
|
|
|
|
|
|
|
*/ |
204
|
2
|
|
|
|
|
|
static void dup_entry(git_blame__entry *dst, git_blame__entry *src) |
205
|
|
|
|
|
|
|
{ |
206
|
|
|
|
|
|
|
git_blame__entry *p, *n; |
207
|
|
|
|
|
|
|
|
208
|
2
|
|
|
|
|
|
p = dst->prev; |
209
|
2
|
|
|
|
|
|
n = dst->next; |
210
|
2
|
|
|
|
|
|
origin_incref(src->suspect); |
211
|
2
|
|
|
|
|
|
origin_decref(dst->suspect); |
212
|
2
|
|
|
|
|
|
memcpy(dst, src, sizeof(*src)); |
213
|
2
|
|
|
|
|
|
dst->prev = p; |
214
|
2
|
|
|
|
|
|
dst->next = n; |
215
|
2
|
|
|
|
|
|
dst->score = 0; |
216
|
2
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
/* |
219
|
|
|
|
|
|
|
* split_overlap() divided an existing blame e into up to three parts in split. |
220
|
|
|
|
|
|
|
* Adjust the linked list of blames in the scoreboard to reflect the split. |
221
|
|
|
|
|
|
|
*/ |
222
|
2
|
|
|
|
|
|
static int split_blame(git_blame *blame, git_blame__entry *split, git_blame__entry *e) |
223
|
|
|
|
|
|
|
{ |
224
|
|
|
|
|
|
|
git_blame__entry *new_entry; |
225
|
|
|
|
|
|
|
|
226
|
2
|
50
|
|
|
|
|
if (split[0].suspect && split[2].suspect) { |
|
|
0
|
|
|
|
|
|
227
|
|
|
|
|
|
|
/* The first part (reuse storage for the existing entry e */ |
228
|
0
|
|
|
|
|
|
dup_entry(e, &split[0]); |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
/* The last part -- me */ |
231
|
0
|
|
|
|
|
|
new_entry = git__malloc(sizeof(*new_entry)); |
232
|
0
|
0
|
|
|
|
|
GIT_ERROR_CHECK_ALLOC(new_entry); |
233
|
0
|
|
|
|
|
|
memcpy(new_entry, &(split[2]), sizeof(git_blame__entry)); |
234
|
0
|
|
|
|
|
|
add_blame_entry(blame, new_entry); |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
/* ... and the middle part -- parent */ |
237
|
0
|
|
|
|
|
|
new_entry = git__malloc(sizeof(*new_entry)); |
238
|
0
|
0
|
|
|
|
|
GIT_ERROR_CHECK_ALLOC(new_entry); |
239
|
0
|
|
|
|
|
|
memcpy(new_entry, &(split[1]), sizeof(git_blame__entry)); |
240
|
0
|
|
|
|
|
|
add_blame_entry(blame, new_entry); |
241
|
2
|
50
|
|
|
|
|
} else if (!split[0].suspect && !split[2].suspect) { |
|
|
50
|
|
|
|
|
|
242
|
|
|
|
|
|
|
/* |
243
|
|
|
|
|
|
|
* The parent covers the entire area; reuse storage for e and replace it |
244
|
|
|
|
|
|
|
* with the parent |
245
|
|
|
|
|
|
|
*/ |
246
|
0
|
|
|
|
|
|
dup_entry(e, &split[1]); |
247
|
2
|
50
|
|
|
|
|
} else if (split[0].suspect) { |
248
|
|
|
|
|
|
|
/* me and then parent */ |
249
|
0
|
|
|
|
|
|
dup_entry(e, &split[0]); |
250
|
0
|
|
|
|
|
|
new_entry = git__malloc(sizeof(*new_entry)); |
251
|
0
|
0
|
|
|
|
|
GIT_ERROR_CHECK_ALLOC(new_entry); |
252
|
0
|
|
|
|
|
|
memcpy(new_entry, &(split[1]), sizeof(git_blame__entry)); |
253
|
0
|
|
|
|
|
|
add_blame_entry(blame, new_entry); |
254
|
|
|
|
|
|
|
} else { |
255
|
|
|
|
|
|
|
/* parent and then me */ |
256
|
2
|
|
|
|
|
|
dup_entry(e, &split[1]); |
257
|
2
|
|
|
|
|
|
new_entry = git__malloc(sizeof(*new_entry)); |
258
|
2
|
50
|
|
|
|
|
GIT_ERROR_CHECK_ALLOC(new_entry); |
259
|
2
|
|
|
|
|
|
memcpy(new_entry, &(split[2]), sizeof(git_blame__entry)); |
260
|
2
|
|
|
|
|
|
add_blame_entry(blame, new_entry); |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
2
|
|
|
|
|
|
return 0; |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
/* |
267
|
|
|
|
|
|
|
* After splitting the blame, the origins used by the on-stack blame_entry |
268
|
|
|
|
|
|
|
* should lose one refcnt each. |
269
|
|
|
|
|
|
|
*/ |
270
|
2
|
|
|
|
|
|
static void decref_split(git_blame__entry *split) |
271
|
|
|
|
|
|
|
{ |
272
|
|
|
|
|
|
|
int i; |
273
|
8
|
100
|
|
|
|
|
for (i=0; i<3; i++) |
274
|
6
|
|
|
|
|
|
origin_decref(split[i].suspect); |
275
|
2
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
/* |
278
|
|
|
|
|
|
|
* Helper for blame_chunk(). blame_entry e is known to overlap with the patch |
279
|
|
|
|
|
|
|
* hunk; split it and pass blame to the parent. |
280
|
|
|
|
|
|
|
*/ |
281
|
2
|
|
|
|
|
|
static int blame_overlap( |
282
|
|
|
|
|
|
|
git_blame *blame, |
283
|
|
|
|
|
|
|
git_blame__entry *e, |
284
|
|
|
|
|
|
|
size_t tlno, |
285
|
|
|
|
|
|
|
size_t plno, |
286
|
|
|
|
|
|
|
size_t same, |
287
|
|
|
|
|
|
|
git_blame__origin *parent) |
288
|
|
|
|
|
|
|
{ |
289
|
2
|
|
|
|
|
|
git_blame__entry split[3] = {{0}}; |
290
|
|
|
|
|
|
|
|
291
|
2
|
|
|
|
|
|
split_overlap(split, e, tlno, plno, same, parent); |
292
|
2
|
50
|
|
|
|
|
if (split[1].suspect) |
293
|
2
|
50
|
|
|
|
|
if (split_blame(blame, split, e) < 0) |
294
|
0
|
|
|
|
|
|
return -1; |
295
|
2
|
|
|
|
|
|
decref_split(split); |
296
|
|
|
|
|
|
|
|
297
|
2
|
|
|
|
|
|
return 0; |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
/* |
301
|
|
|
|
|
|
|
* Process one hunk from the patch between the current suspect for blame_entry |
302
|
|
|
|
|
|
|
* e and its parent. Find and split the overlap, and pass blame to the |
303
|
|
|
|
|
|
|
* overlapping part to the parent. |
304
|
|
|
|
|
|
|
*/ |
305
|
4
|
|
|
|
|
|
static int blame_chunk( |
306
|
|
|
|
|
|
|
git_blame *blame, |
307
|
|
|
|
|
|
|
size_t tlno, |
308
|
|
|
|
|
|
|
size_t plno, |
309
|
|
|
|
|
|
|
size_t same, |
310
|
|
|
|
|
|
|
git_blame__origin *target, |
311
|
|
|
|
|
|
|
git_blame__origin *parent) |
312
|
|
|
|
|
|
|
{ |
313
|
|
|
|
|
|
|
git_blame__entry *e; |
314
|
|
|
|
|
|
|
|
315
|
14
|
100
|
|
|
|
|
for (e = blame->ent; e; e = e->next) { |
316
|
10
|
100
|
|
|
|
|
if (e->guilty || !same_suspect(e->suspect, target)) |
|
|
100
|
|
|
|
|
|
317
|
4
|
|
|
|
|
|
continue; |
318
|
6
|
100
|
|
|
|
|
if (same <= e->s_lno) |
319
|
2
|
|
|
|
|
|
continue; |
320
|
4
|
100
|
|
|
|
|
if (tlno < e->s_lno + e->num_lines) { |
321
|
2
|
50
|
|
|
|
|
if (blame_overlap(blame, e, tlno, plno, same, parent) < 0) |
322
|
0
|
|
|
|
|
|
return -1; |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
|
326
|
4
|
|
|
|
|
|
return 0; |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
|
329
|
2
|
|
|
|
|
|
static int my_emit( |
330
|
|
|
|
|
|
|
long start_a, long count_a, |
331
|
|
|
|
|
|
|
long start_b, long count_b, |
332
|
|
|
|
|
|
|
void *cb_data) |
333
|
|
|
|
|
|
|
{ |
334
|
2
|
|
|
|
|
|
blame_chunk_cb_data *d = (blame_chunk_cb_data *)cb_data; |
335
|
|
|
|
|
|
|
|
336
|
2
|
50
|
|
|
|
|
if (blame_chunk(d->blame, d->tlno, d->plno, start_b, d->target, d->parent) < 0) |
337
|
0
|
|
|
|
|
|
return -1; |
338
|
2
|
|
|
|
|
|
d->plno = start_a + count_a; |
339
|
2
|
|
|
|
|
|
d->tlno = start_b + count_b; |
340
|
|
|
|
|
|
|
|
341
|
2
|
|
|
|
|
|
return 0; |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
|
344
|
2
|
|
|
|
|
|
static void trim_common_tail(mmfile_t *a, mmfile_t *b, long ctx) |
345
|
|
|
|
|
|
|
{ |
346
|
2
|
|
|
|
|
|
const int blk = 1024; |
347
|
2
|
|
|
|
|
|
long trimmed = 0, recovered = 0; |
348
|
2
|
|
|
|
|
|
char *ap = a->ptr + a->size; |
349
|
2
|
|
|
|
|
|
char *bp = b->ptr + b->size; |
350
|
2
|
|
|
|
|
|
long smaller = (long)((a->size < b->size) ? a->size : b->size); |
351
|
|
|
|
|
|
|
|
352
|
2
|
50
|
|
|
|
|
if (ctx) |
353
|
0
|
|
|
|
|
|
return; |
354
|
|
|
|
|
|
|
|
355
|
2
|
50
|
|
|
|
|
while (blk + trimmed <= smaller && !memcmp(ap - blk, bp - blk, blk)) { |
|
|
0
|
|
|
|
|
|
356
|
0
|
|
|
|
|
|
trimmed += blk; |
357
|
0
|
|
|
|
|
|
ap -= blk; |
358
|
0
|
|
|
|
|
|
bp -= blk; |
359
|
|
|
|
|
|
|
} |
360
|
|
|
|
|
|
|
|
361
|
2
|
50
|
|
|
|
|
while (recovered < trimmed) |
362
|
0
|
0
|
|
|
|
|
if (ap[recovered++] == '\n') |
363
|
0
|
|
|
|
|
|
break; |
364
|
2
|
|
|
|
|
|
a->size -= trimmed - recovered; |
365
|
2
|
|
|
|
|
|
b->size -= trimmed - recovered; |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
|
368
|
2
|
|
|
|
|
|
static int diff_hunks(mmfile_t file_a, mmfile_t file_b, void *cb_data) |
369
|
|
|
|
|
|
|
{ |
370
|
2
|
|
|
|
|
|
xpparam_t xpp = {0}; |
371
|
2
|
|
|
|
|
|
xdemitconf_t xecfg = {0}; |
372
|
2
|
|
|
|
|
|
xdemitcb_t ecb = {0}; |
373
|
|
|
|
|
|
|
|
374
|
2
|
|
|
|
|
|
xecfg.hunk_func = my_emit; |
375
|
2
|
|
|
|
|
|
ecb.priv = cb_data; |
376
|
|
|
|
|
|
|
|
377
|
2
|
|
|
|
|
|
trim_common_tail(&file_a, &file_b, 0); |
378
|
|
|
|
|
|
|
|
379
|
2
|
50
|
|
|
|
|
if (file_a.size > GIT_XDIFF_MAX_SIZE || |
|
|
50
|
|
|
|
|
|
380
|
2
|
|
|
|
|
|
file_b.size > GIT_XDIFF_MAX_SIZE) { |
381
|
0
|
|
|
|
|
|
git_error_set(GIT_ERROR_INVALID, "file too large to blame"); |
382
|
0
|
|
|
|
|
|
return -1; |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
|
385
|
2
|
|
|
|
|
|
return xdl_diff(&file_a, &file_b, &xpp, &xecfg, &ecb); |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
4
|
|
|
|
|
|
static void fill_origin_blob(git_blame__origin *o, mmfile_t *file) |
389
|
|
|
|
|
|
|
{ |
390
|
4
|
|
|
|
|
|
memset(file, 0, sizeof(*file)); |
391
|
4
|
50
|
|
|
|
|
if (o->blob) { |
392
|
4
|
|
|
|
|
|
file->ptr = (char*)git_blob_rawcontent(o->blob); |
393
|
4
|
|
|
|
|
|
file->size = (size_t)git_blob_rawsize(o->blob); |
394
|
|
|
|
|
|
|
} |
395
|
4
|
|
|
|
|
|
} |
396
|
|
|
|
|
|
|
|
397
|
2
|
|
|
|
|
|
static int pass_blame_to_parent( |
398
|
|
|
|
|
|
|
git_blame *blame, |
399
|
|
|
|
|
|
|
git_blame__origin *target, |
400
|
|
|
|
|
|
|
git_blame__origin *parent) |
401
|
|
|
|
|
|
|
{ |
402
|
|
|
|
|
|
|
size_t last_in_target; |
403
|
|
|
|
|
|
|
mmfile_t file_p, file_o; |
404
|
2
|
|
|
|
|
|
blame_chunk_cb_data d = { blame, target, parent, 0, 0 }; |
405
|
|
|
|
|
|
|
|
406
|
2
|
50
|
|
|
|
|
if (!find_last_in_target(&last_in_target, blame, target)) |
407
|
0
|
|
|
|
|
|
return 1; /* nothing remains for this target */ |
408
|
|
|
|
|
|
|
|
409
|
2
|
|
|
|
|
|
fill_origin_blob(parent, &file_p); |
410
|
2
|
|
|
|
|
|
fill_origin_blob(target, &file_o); |
411
|
|
|
|
|
|
|
|
412
|
2
|
50
|
|
|
|
|
if (diff_hunks(file_p, file_o, &d) < 0) |
413
|
0
|
|
|
|
|
|
return -1; |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
/* The reset (i.e. anything after tlno) are the same as the parent */ |
416
|
2
|
50
|
|
|
|
|
if (blame_chunk(blame, d.tlno, d.plno, last_in_target, target, parent) < 0) |
417
|
0
|
|
|
|
|
|
return -1; |
418
|
|
|
|
|
|
|
|
419
|
2
|
|
|
|
|
|
return 0; |
420
|
|
|
|
|
|
|
} |
421
|
|
|
|
|
|
|
|
422
|
3
|
|
|
|
|
|
static int paths_on_dup(void **old, void *new) |
423
|
|
|
|
|
|
|
{ |
424
|
|
|
|
|
|
|
GIT_UNUSED(old); |
425
|
3
|
|
|
|
|
|
git__free(new); |
426
|
3
|
|
|
|
|
|
return -1; |
427
|
|
|
|
|
|
|
} |
428
|
|
|
|
|
|
|
|
429
|
3
|
|
|
|
|
|
static git_blame__origin* find_origin( |
430
|
|
|
|
|
|
|
git_blame *blame, |
431
|
|
|
|
|
|
|
git_commit *parent, |
432
|
|
|
|
|
|
|
git_blame__origin *origin) |
433
|
|
|
|
|
|
|
{ |
434
|
3
|
|
|
|
|
|
git_blame__origin *porigin = NULL; |
435
|
3
|
|
|
|
|
|
git_diff *difflist = NULL; |
436
|
3
|
|
|
|
|
|
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT; |
437
|
3
|
|
|
|
|
|
git_tree *otree=NULL, *ptree=NULL; |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
/* Get the trees from this commit and its parent */ |
440
|
6
|
|
|
|
|
|
if (0 != git_commit_tree(&otree, origin->commit) || |
441
|
3
|
|
|
|
|
|
0 != git_commit_tree(&ptree, parent)) |
442
|
|
|
|
|
|
|
goto cleanup; |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
/* Configure the diff */ |
445
|
3
|
|
|
|
|
|
diffopts.context_lines = 0; |
446
|
3
|
|
|
|
|
|
diffopts.flags = GIT_DIFF_SKIP_BINARY_CHECK; |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
/* Check to see if files we're interested have changed */ |
449
|
3
|
|
|
|
|
|
diffopts.pathspec.count = blame->paths.length; |
450
|
3
|
|
|
|
|
|
diffopts.pathspec.strings = (char**)blame->paths.contents; |
451
|
3
|
50
|
|
|
|
|
if (0 != git_diff_tree_to_tree(&difflist, blame->repository, ptree, otree, &diffopts)) |
452
|
0
|
|
|
|
|
|
goto cleanup; |
453
|
|
|
|
|
|
|
|
454
|
3
|
50
|
|
|
|
|
if (!git_diff_num_deltas(difflist)) { |
455
|
|
|
|
|
|
|
/* No changes; copy data */ |
456
|
0
|
|
|
|
|
|
git_blame__get_origin(&porigin, blame, parent, origin->path); |
457
|
|
|
|
|
|
|
} else { |
458
|
3
|
|
|
|
|
|
git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT; |
459
|
|
|
|
|
|
|
int i; |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
/* Generate a full diff between the two trees */ |
462
|
3
|
|
|
|
|
|
git_diff_free(difflist); |
463
|
3
|
|
|
|
|
|
diffopts.pathspec.count = 0; |
464
|
3
|
50
|
|
|
|
|
if (0 != git_diff_tree_to_tree(&difflist, blame->repository, ptree, otree, &diffopts)) |
465
|
0
|
|
|
|
|
|
goto cleanup; |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
/* Let diff find renames */ |
468
|
3
|
|
|
|
|
|
findopts.flags = GIT_DIFF_FIND_RENAMES; |
469
|
3
|
50
|
|
|
|
|
if (0 != git_diff_find_similar(difflist, &findopts)) |
470
|
0
|
|
|
|
|
|
goto cleanup; |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
/* Find one that matches */ |
473
|
6
|
100
|
|
|
|
|
for (i=0; i<(int)git_diff_num_deltas(difflist); i++) { |
474
|
3
|
|
|
|
|
|
const git_diff_delta *delta = git_diff_get_delta(difflist, i); |
475
|
|
|
|
|
|
|
|
476
|
3
|
50
|
|
|
|
|
if (!git_vector_bsearch(NULL, &blame->paths, delta->new_file.path)) |
477
|
|
|
|
|
|
|
{ |
478
|
3
|
|
|
|
|
|
git_vector_insert_sorted(&blame->paths, (void*)git__strdup(delta->old_file.path), |
479
|
|
|
|
|
|
|
paths_on_dup); |
480
|
3
|
|
|
|
|
|
make_origin(&porigin, parent, delta->old_file.path); |
481
|
|
|
|
|
|
|
} |
482
|
|
|
|
|
|
|
} |
483
|
|
|
|
|
|
|
} |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
cleanup: |
486
|
3
|
|
|
|
|
|
git_diff_free(difflist); |
487
|
3
|
|
|
|
|
|
git_tree_free(otree); |
488
|
3
|
|
|
|
|
|
git_tree_free(ptree); |
489
|
3
|
|
|
|
|
|
return porigin; |
490
|
|
|
|
|
|
|
} |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
/* |
493
|
|
|
|
|
|
|
* The blobs of origin and porigin exactly match, so everything origin is |
494
|
|
|
|
|
|
|
* suspected for can be blamed on the parent. |
495
|
|
|
|
|
|
|
*/ |
496
|
0
|
|
|
|
|
|
static int pass_whole_blame(git_blame *blame, |
497
|
|
|
|
|
|
|
git_blame__origin *origin, git_blame__origin *porigin) |
498
|
|
|
|
|
|
|
{ |
499
|
|
|
|
|
|
|
git_blame__entry *e; |
500
|
|
|
|
|
|
|
|
501
|
0
|
|
|
|
|
|
if (!porigin->blob && |
502
|
0
|
|
|
|
|
|
git_object_lookup((git_object**)&porigin->blob, blame->repository, |
503
|
0
|
|
|
|
|
|
git_blob_id(origin->blob), GIT_OBJECT_BLOB) < 0) |
504
|
0
|
|
|
|
|
|
return -1; |
505
|
0
|
0
|
|
|
|
|
for (e=blame->ent; e; e=e->next) { |
506
|
0
|
0
|
|
|
|
|
if (!same_suspect(e->suspect, origin)) |
507
|
0
|
|
|
|
|
|
continue; |
508
|
0
|
|
|
|
|
|
origin_incref(porigin); |
509
|
0
|
|
|
|
|
|
origin_decref(e->suspect); |
510
|
0
|
|
|
|
|
|
e->suspect = porigin; |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
|
513
|
0
|
|
|
|
|
|
return 0; |
514
|
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
|
|
516
|
3
|
|
|
|
|
|
static int pass_blame(git_blame *blame, git_blame__origin *origin, uint32_t opt) |
517
|
|
|
|
|
|
|
{ |
518
|
3
|
|
|
|
|
|
git_commit *commit = origin->commit; |
519
|
|
|
|
|
|
|
int i, num_parents; |
520
|
|
|
|
|
|
|
git_blame__origin *sg_buf[16]; |
521
|
3
|
|
|
|
|
|
git_blame__origin *porigin, **sg_origin = sg_buf; |
522
|
3
|
|
|
|
|
|
int ret, error = 0; |
523
|
|
|
|
|
|
|
|
524
|
3
|
|
|
|
|
|
num_parents = git_commit_parentcount(commit); |
525
|
3
|
50
|
|
|
|
|
if (!git_oid_cmp(git_commit_id(commit), &blame->options.oldest_commit)) |
526
|
|
|
|
|
|
|
/* Stop at oldest specified commit */ |
527
|
0
|
|
|
|
|
|
num_parents = 0; |
528
|
3
|
50
|
|
|
|
|
else if (opt & GIT_BLAME_FIRST_PARENT && num_parents > 1) |
|
|
0
|
|
|
|
|
|
529
|
|
|
|
|
|
|
/* Limit search to the first parent */ |
530
|
0
|
|
|
|
|
|
num_parents = 1; |
531
|
|
|
|
|
|
|
|
532
|
3
|
50
|
|
|
|
|
if (!num_parents) { |
533
|
0
|
|
|
|
|
|
git_oid_cpy(&blame->options.oldest_commit, git_commit_id(commit)); |
534
|
0
|
|
|
|
|
|
goto finish; |
535
|
3
|
50
|
|
|
|
|
} else if (num_parents < (int)ARRAY_SIZE(sg_buf)) |
536
|
3
|
|
|
|
|
|
memset(sg_buf, 0, sizeof(sg_buf)); |
537
|
|
|
|
|
|
|
else { |
538
|
0
|
|
|
|
|
|
sg_origin = git__calloc(num_parents, sizeof(*sg_origin)); |
539
|
0
|
0
|
|
|
|
|
GIT_ERROR_CHECK_ALLOC(sg_origin); |
540
|
|
|
|
|
|
|
} |
541
|
|
|
|
|
|
|
|
542
|
6
|
100
|
|
|
|
|
for (i=0; i
|
543
|
|
|
|
|
|
|
git_commit *p; |
544
|
|
|
|
|
|
|
int j, same; |
545
|
|
|
|
|
|
|
|
546
|
3
|
50
|
|
|
|
|
if (sg_origin[i]) |
547
|
1
|
|
|
|
|
|
continue; |
548
|
|
|
|
|
|
|
|
549
|
3
|
50
|
|
|
|
|
if ((error = git_commit_parent(&p, origin->commit, i)) < 0) |
550
|
0
|
|
|
|
|
|
goto finish; |
551
|
3
|
|
|
|
|
|
porigin = find_origin(blame, p, origin); |
552
|
|
|
|
|
|
|
|
553
|
3
|
100
|
|
|
|
|
if (!porigin) { |
554
|
|
|
|
|
|
|
/* |
555
|
|
|
|
|
|
|
* We only have to decrement the parent's |
556
|
|
|
|
|
|
|
* reference count when no porigin has |
557
|
|
|
|
|
|
|
* been created, as otherwise the commit |
558
|
|
|
|
|
|
|
* is assigned to the created object. |
559
|
|
|
|
|
|
|
*/ |
560
|
1
|
|
|
|
|
|
git_commit_free(p); |
561
|
1
|
|
|
|
|
|
continue; |
562
|
|
|
|
|
|
|
} |
563
|
4
|
50
|
|
|
|
|
if (porigin->blob && origin->blob && |
564
|
2
|
|
|
|
|
|
!git_oid_cmp(git_blob_id(porigin->blob), git_blob_id(origin->blob))) { |
565
|
0
|
|
|
|
|
|
error = pass_whole_blame(blame, origin, porigin); |
566
|
0
|
|
|
|
|
|
origin_decref(porigin); |
567
|
0
|
|
|
|
|
|
goto finish; |
568
|
|
|
|
|
|
|
} |
569
|
2
|
50
|
|
|
|
|
for (j = same = 0; j
|
570
|
0
|
|
|
|
|
|
if (sg_origin[j] && |
571
|
0
|
|
|
|
|
|
!git_oid_cmp(git_blob_id(sg_origin[j]->blob), git_blob_id(porigin->blob))) { |
572
|
0
|
|
|
|
|
|
same = 1; |
573
|
0
|
|
|
|
|
|
break; |
574
|
|
|
|
|
|
|
} |
575
|
2
|
50
|
|
|
|
|
if (!same) |
576
|
2
|
|
|
|
|
|
sg_origin[i] = porigin; |
577
|
|
|
|
|
|
|
else |
578
|
2
|
|
|
|
|
|
origin_decref(porigin); |
579
|
|
|
|
|
|
|
} |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
/* Standard blame */ |
582
|
6
|
100
|
|
|
|
|
for (i=0; i
|
583
|
3
|
|
|
|
|
|
git_blame__origin *porigin = sg_origin[i]; |
584
|
3
|
100
|
|
|
|
|
if (!porigin) |
585
|
1
|
|
|
|
|
|
continue; |
586
|
2
|
50
|
|
|
|
|
if (!origin->previous) { |
587
|
2
|
|
|
|
|
|
origin_incref(porigin); |
588
|
2
|
|
|
|
|
|
origin->previous = porigin; |
589
|
|
|
|
|
|
|
} |
590
|
|
|
|
|
|
|
|
591
|
2
|
50
|
|
|
|
|
if ((ret = pass_blame_to_parent(blame, origin, porigin)) != 0) { |
592
|
0
|
0
|
|
|
|
|
if (ret < 0) |
593
|
0
|
|
|
|
|
|
error = -1; |
594
|
|
|
|
|
|
|
|
595
|
0
|
|
|
|
|
|
goto finish; |
596
|
|
|
|
|
|
|
} |
597
|
|
|
|
|
|
|
} |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
/* TODO: optionally find moves in parents' files */ |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
/* TODO: optionally find copies in parents' files */ |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
finish: |
604
|
6
|
100
|
|
|
|
|
for (i=0; i
|
605
|
3
|
100
|
|
|
|
|
if (sg_origin[i]) |
606
|
2
|
|
|
|
|
|
origin_decref(sg_origin[i]); |
607
|
3
|
50
|
|
|
|
|
if (sg_origin != sg_buf) |
608
|
0
|
|
|
|
|
|
git__free(sg_origin); |
609
|
3
|
|
|
|
|
|
return error; |
610
|
|
|
|
|
|
|
} |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
/* |
613
|
|
|
|
|
|
|
* If two blame entries that are next to each other came from |
614
|
|
|
|
|
|
|
* contiguous lines in the same origin (i.e. pair), |
615
|
|
|
|
|
|
|
* merge them together. |
616
|
|
|
|
|
|
|
*/ |
617
|
1
|
|
|
|
|
|
static void coalesce(git_blame *blame) |
618
|
|
|
|
|
|
|
{ |
619
|
|
|
|
|
|
|
git_blame__entry *ent, *next; |
620
|
|
|
|
|
|
|
|
621
|
3
|
50
|
|
|
|
|
for (ent=blame->ent; ent && (next = ent->next); ent = next) { |
|
|
100
|
|
|
|
|
|
622
|
2
|
50
|
|
|
|
|
if (same_suspect(ent->suspect, next->suspect) && |
|
|
0
|
|
|
|
|
|
623
|
0
|
0
|
|
|
|
|
ent->guilty == next->guilty && |
624
|
0
|
|
|
|
|
|
ent->s_lno + ent->num_lines == next->s_lno) |
625
|
|
|
|
|
|
|
{ |
626
|
0
|
|
|
|
|
|
ent->num_lines += next->num_lines; |
627
|
0
|
|
|
|
|
|
ent->next = next->next; |
628
|
0
|
0
|
|
|
|
|
if (ent->next) |
629
|
0
|
|
|
|
|
|
ent->next->prev = ent; |
630
|
0
|
|
|
|
|
|
origin_decref(next->suspect); |
631
|
0
|
|
|
|
|
|
git__free(next); |
632
|
0
|
|
|
|
|
|
ent->score = 0; |
633
|
0
|
|
|
|
|
|
next = ent; /* again */ |
634
|
|
|
|
|
|
|
} |
635
|
|
|
|
|
|
|
} |
636
|
1
|
|
|
|
|
|
} |
637
|
|
|
|
|
|
|
|
638
|
1
|
|
|
|
|
|
int git_blame__like_git(git_blame *blame, uint32_t opt) |
639
|
|
|
|
|
|
|
{ |
640
|
1
|
|
|
|
|
|
int error = 0; |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
while (true) { |
643
|
|
|
|
|
|
|
git_blame__entry *ent; |
644
|
4
|
|
|
|
|
|
git_blame__origin *suspect = NULL; |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
/* Find a suspect to break down */ |
647
|
10
|
100
|
|
|
|
|
for (ent = blame->ent; !suspect && ent; ent = ent->next) |
|
|
100
|
|
|
|
|
|
648
|
6
|
100
|
|
|
|
|
if (!ent->guilty) |
649
|
3
|
|
|
|
|
|
suspect = ent->suspect; |
650
|
4
|
100
|
|
|
|
|
if (!suspect) |
651
|
1
|
|
|
|
|
|
break; |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
/* We'll use this suspect later in the loop, so hold on to it for now. */ |
654
|
3
|
|
|
|
|
|
origin_incref(suspect); |
655
|
|
|
|
|
|
|
|
656
|
3
|
50
|
|
|
|
|
if ((error = pass_blame(blame, suspect, opt)) < 0) |
657
|
0
|
|
|
|
|
|
break; |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
/* Take responsibility for the remaining entries */ |
660
|
11
|
100
|
|
|
|
|
for (ent = blame->ent; ent; ent = ent->next) { |
661
|
8
|
100
|
|
|
|
|
if (same_suspect(ent->suspect, suspect)) { |
662
|
3
|
|
|
|
|
|
ent->guilty = true; |
663
|
3
|
|
|
|
|
|
ent->is_boundary = !git_oid_cmp( |
664
|
3
|
|
|
|
|
|
git_commit_id(suspect->commit), |
665
|
3
|
|
|
|
|
|
&blame->options.oldest_commit); |
666
|
|
|
|
|
|
|
} |
667
|
|
|
|
|
|
|
} |
668
|
3
|
|
|
|
|
|
origin_decref(suspect); |
669
|
3
|
|
|
|
|
|
} |
670
|
|
|
|
|
|
|
|
671
|
1
|
50
|
|
|
|
|
if (!error) |
672
|
1
|
|
|
|
|
|
coalesce(blame); |
673
|
|
|
|
|
|
|
|
674
|
1
|
|
|
|
|
|
return error; |
675
|
|
|
|
|
|
|
} |
676
|
|
|
|
|
|
|
|
677
|
3
|
|
|
|
|
|
void git_blame__free_entry(git_blame__entry *ent) |
678
|
|
|
|
|
|
|
{ |
679
|
3
|
50
|
|
|
|
|
if (!ent) return; |
680
|
3
|
|
|
|
|
|
origin_decref(ent->suspect); |
681
|
3
|
|
|
|
|
|
git__free(ent); |
682
|
|
|
|
|
|
|
} |