Blame


1 404c43c4 2018-06-21 stsp /*
2 404c43c4 2018-06-21 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 404c43c4 2018-06-21 stsp *
4 404c43c4 2018-06-21 stsp * Permission to use, copy, modify, and distribute this software for any
5 404c43c4 2018-06-21 stsp * purpose with or without fee is hereby granted, provided that the above
6 404c43c4 2018-06-21 stsp * copyright notice and this permission notice appear in all copies.
7 404c43c4 2018-06-21 stsp *
8 404c43c4 2018-06-21 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 404c43c4 2018-06-21 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 404c43c4 2018-06-21 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 404c43c4 2018-06-21 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 404c43c4 2018-06-21 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 404c43c4 2018-06-21 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 404c43c4 2018-06-21 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 404c43c4 2018-06-21 stsp */
16 404c43c4 2018-06-21 stsp
17 404c43c4 2018-06-21 stsp #include <sys/queue.h>
18 404c43c4 2018-06-21 stsp #include <sys/stat.h>
19 404c43c4 2018-06-21 stsp
20 404c43c4 2018-06-21 stsp #include <sha1.h>
21 404c43c4 2018-06-21 stsp #include <string.h>
22 404c43c4 2018-06-21 stsp #include <stdio.h>
23 404c43c4 2018-06-21 stsp #include <stdlib.h>
24 404c43c4 2018-06-21 stsp #include <time.h>
25 404c43c4 2018-06-21 stsp #include <util.h>
26 404c43c4 2018-06-21 stsp #include <zlib.h>
27 404c43c4 2018-06-21 stsp
28 404c43c4 2018-06-21 stsp #include "got_error.h"
29 404c43c4 2018-06-21 stsp #include "got_object.h"
30 404c43c4 2018-06-21 stsp #include "got_blame.h"
31 404c43c4 2018-06-21 stsp #include "got_opentemp.h"
32 404c43c4 2018-06-21 stsp
33 63581804 2018-07-09 stsp #include "got_lib_inflate.h"
34 404c43c4 2018-06-21 stsp #include "got_lib_delta.h"
35 404c43c4 2018-06-21 stsp #include "got_lib_object.h"
36 404c43c4 2018-06-21 stsp #include "got_lib_diff.h"
37 404c43c4 2018-06-21 stsp
38 404c43c4 2018-06-21 stsp struct got_blame_line {
39 404c43c4 2018-06-21 stsp int annotated;
40 9b94757a 2018-06-21 stsp struct got_object_id id;
41 404c43c4 2018-06-21 stsp };
42 404c43c4 2018-06-21 stsp
43 404c43c4 2018-06-21 stsp struct got_blame {
44 404c43c4 2018-06-21 stsp FILE *f;
45 404c43c4 2018-06-21 stsp size_t nlines;
46 404c43c4 2018-06-21 stsp struct got_blame_line *lines; /* one per line */
47 404c43c4 2018-06-21 stsp };
48 404c43c4 2018-06-21 stsp
49 404c43c4 2018-06-21 stsp static const struct got_error *
50 84451b3e 2018-07-10 stsp annotate_line(struct got_blame *blame, int lineno, struct got_object_id *id,
51 84451b3e 2018-07-10 stsp const struct got_error *(*cb)(void *, int, int, struct got_object_id *),
52 84451b3e 2018-07-10 stsp void *arg)
53 404c43c4 2018-06-21 stsp {
54 404c43c4 2018-06-21 stsp const struct got_error *err = NULL;
55 404c43c4 2018-06-21 stsp struct got_blame_line *line;
56 404c43c4 2018-06-21 stsp
57 404c43c4 2018-06-21 stsp if (lineno < 1 || lineno > blame->nlines)
58 84451b3e 2018-07-10 stsp return got_error(GOT_ERR_RANGE);
59 404c43c4 2018-06-21 stsp
60 404c43c4 2018-06-21 stsp line = &blame->lines[lineno - 1];
61 404c43c4 2018-06-21 stsp if (line->annotated)
62 84451b3e 2018-07-10 stsp return NULL;
63 404c43c4 2018-06-21 stsp
64 404c43c4 2018-06-21 stsp memcpy(&line->id, id, sizeof(line->id));
65 404c43c4 2018-06-21 stsp line->annotated = 1;
66 84451b3e 2018-07-10 stsp if (cb)
67 84451b3e 2018-07-10 stsp err = cb(arg, blame->nlines, lineno, id);
68 84451b3e 2018-07-10 stsp return err;
69 404c43c4 2018-06-21 stsp }
70 404c43c4 2018-06-21 stsp
71 404c43c4 2018-06-21 stsp static const struct got_error *
72 404c43c4 2018-06-21 stsp blame_commit(struct got_blame *blame, struct got_object_id *id,
73 84451b3e 2018-07-10 stsp struct got_object_id *pid, const char *path, struct got_repository *repo,
74 84451b3e 2018-07-10 stsp const struct got_error *(*cb)(void *, int, int, struct got_object_id *),
75 84451b3e 2018-07-10 stsp void *arg)
76 404c43c4 2018-06-21 stsp {
77 404c43c4 2018-06-21 stsp const struct got_error *err = NULL;
78 404c43c4 2018-06-21 stsp struct got_object *obj = NULL, *pobj = NULL;
79 404c43c4 2018-06-21 stsp struct got_blob_object *blob = NULL, *pblob = NULL;
80 404c43c4 2018-06-21 stsp struct got_diff_changes *changes = NULL;
81 404c43c4 2018-06-21 stsp
82 404c43c4 2018-06-21 stsp err = got_object_open_by_path(&obj, repo, id, path);
83 404c43c4 2018-06-21 stsp if (err)
84 404c43c4 2018-06-21 stsp goto done;
85 404c43c4 2018-06-21 stsp if (got_object_get_type(obj) != GOT_OBJ_TYPE_BLOB) {
86 404c43c4 2018-06-21 stsp err = got_error(GOT_ERR_OBJ_TYPE);
87 404c43c4 2018-06-21 stsp goto done;
88 404c43c4 2018-06-21 stsp }
89 404c43c4 2018-06-21 stsp
90 404c43c4 2018-06-21 stsp err = got_object_open_by_path(&pobj, repo, pid, path);
91 404c43c4 2018-06-21 stsp if (err) {
92 404c43c4 2018-06-21 stsp if (err->code == GOT_ERR_NO_OBJ) {
93 404c43c4 2018-06-21 stsp /* Blob's history began in previous commit. */
94 404c43c4 2018-06-21 stsp err = got_error(GOT_ERR_ITER_COMPLETED);
95 404c43c4 2018-06-21 stsp }
96 404c43c4 2018-06-21 stsp goto done;
97 404c43c4 2018-06-21 stsp }
98 404c43c4 2018-06-21 stsp if (got_object_get_type(pobj) != GOT_OBJ_TYPE_BLOB) {
99 404c43c4 2018-06-21 stsp /*
100 404c43c4 2018-06-21 stsp * Encountered a non-blob at the path (probably a tree).
101 404c43c4 2018-06-21 stsp * Blob's history began in previous commit.
102 404c43c4 2018-06-21 stsp */
103 404c43c4 2018-06-21 stsp err = got_error(GOT_ERR_ITER_COMPLETED);
104 404c43c4 2018-06-21 stsp goto done;
105 404c43c4 2018-06-21 stsp }
106 404c43c4 2018-06-21 stsp
107 404c43c4 2018-06-21 stsp /* If blob hashes match then don't bother with diffing. */
108 89a4e64f 2018-07-11 stsp if (got_object_id_cmp(&obj->id, &pobj->id) == 0) {
109 89a4e64f 2018-07-11 stsp if (cb)
110 89a4e64f 2018-07-11 stsp err = cb(arg, blame->nlines, -1, id);
111 404c43c4 2018-06-21 stsp goto done;
112 89a4e64f 2018-07-11 stsp }
113 404c43c4 2018-06-21 stsp
114 404c43c4 2018-06-21 stsp err = got_object_blob_open(&blob, repo, obj, 8192);
115 404c43c4 2018-06-21 stsp if (err)
116 404c43c4 2018-06-21 stsp goto done;
117 404c43c4 2018-06-21 stsp
118 404c43c4 2018-06-21 stsp err = got_object_blob_open(&pblob, repo, pobj, 8192);
119 404c43c4 2018-06-21 stsp if (err)
120 404c43c4 2018-06-21 stsp goto done;
121 404c43c4 2018-06-21 stsp
122 404c43c4 2018-06-21 stsp err = got_diff_blob_lines_changed(&changes, blob, pblob);
123 404c43c4 2018-06-21 stsp if (err)
124 404c43c4 2018-06-21 stsp goto done;
125 404c43c4 2018-06-21 stsp
126 404c43c4 2018-06-21 stsp if (changes) {
127 404c43c4 2018-06-21 stsp struct got_diff_change *change;
128 404c43c4 2018-06-21 stsp SIMPLEQ_FOREACH(change, &changes->entries, entry) {
129 404c43c4 2018-06-21 stsp int a = change->cv.a;
130 404c43c4 2018-06-21 stsp int b = change->cv.b;
131 404c43c4 2018-06-21 stsp int lineno;
132 84451b3e 2018-07-10 stsp for (lineno = a; lineno <= b; lineno++) {
133 84451b3e 2018-07-10 stsp err = annotate_line(blame, lineno, id, cb, arg);
134 84451b3e 2018-07-10 stsp if (err)
135 84451b3e 2018-07-10 stsp goto done;
136 84451b3e 2018-07-10 stsp }
137 404c43c4 2018-06-21 stsp }
138 d68a0a7d 2018-07-10 stsp } else if (cb)
139 3bf198ba 2018-07-10 stsp err = cb(arg, blame->nlines, -1, id);
140 404c43c4 2018-06-21 stsp done:
141 404c43c4 2018-06-21 stsp if (obj)
142 404c43c4 2018-06-21 stsp got_object_close(obj);
143 404c43c4 2018-06-21 stsp if (pobj)
144 404c43c4 2018-06-21 stsp got_object_close(pobj);
145 404c43c4 2018-06-21 stsp if (blob)
146 404c43c4 2018-06-21 stsp got_object_blob_close(blob);
147 404c43c4 2018-06-21 stsp if (pblob)
148 404c43c4 2018-06-21 stsp got_object_blob_close(pblob);
149 404c43c4 2018-06-21 stsp return err;
150 404c43c4 2018-06-21 stsp }
151 404c43c4 2018-06-21 stsp
152 404c43c4 2018-06-21 stsp static void
153 404c43c4 2018-06-21 stsp blame_close(struct got_blame *blame)
154 404c43c4 2018-06-21 stsp {
155 404c43c4 2018-06-21 stsp if (blame->f)
156 404c43c4 2018-06-21 stsp fclose(blame->f);
157 404c43c4 2018-06-21 stsp free(blame->lines);
158 404c43c4 2018-06-21 stsp free(blame);
159 404c43c4 2018-06-21 stsp }
160 404c43c4 2018-06-21 stsp
161 404c43c4 2018-06-21 stsp static const struct got_error *
162 404c43c4 2018-06-21 stsp blame_open(struct got_blame **blamep, const char *path,
163 84451b3e 2018-07-10 stsp struct got_object_id *start_commit_id, struct got_repository *repo,
164 84451b3e 2018-07-10 stsp const struct got_error *(*cb)(void *, int, int, struct got_object_id *),
165 84451b3e 2018-07-10 stsp void *arg)
166 404c43c4 2018-06-21 stsp {
167 404c43c4 2018-06-21 stsp const struct got_error *err = NULL;
168 404c43c4 2018-06-21 stsp struct got_object *obj = NULL;
169 404c43c4 2018-06-21 stsp struct got_blob_object *blob = NULL;
170 404c43c4 2018-06-21 stsp struct got_blame *blame = NULL;
171 404c43c4 2018-06-21 stsp struct got_commit_object *commit = NULL;
172 404c43c4 2018-06-21 stsp struct got_object_id *id = NULL;
173 404c43c4 2018-06-21 stsp int lineno;
174 404c43c4 2018-06-21 stsp
175 404c43c4 2018-06-21 stsp *blamep = NULL;
176 404c43c4 2018-06-21 stsp
177 404c43c4 2018-06-21 stsp err = got_object_open_by_path(&obj, repo, start_commit_id, path);
178 404c43c4 2018-06-21 stsp if (err)
179 404c43c4 2018-06-21 stsp return err;
180 404c43c4 2018-06-21 stsp if (got_object_get_type(obj) != GOT_OBJ_TYPE_BLOB) {
181 404c43c4 2018-06-21 stsp err = got_error(GOT_ERR_OBJ_TYPE);
182 404c43c4 2018-06-21 stsp goto done;
183 404c43c4 2018-06-21 stsp }
184 404c43c4 2018-06-21 stsp
185 404c43c4 2018-06-21 stsp err = got_object_blob_open(&blob, repo, obj, 8192);
186 404c43c4 2018-06-21 stsp if (err)
187 404c43c4 2018-06-21 stsp goto done;
188 404c43c4 2018-06-21 stsp
189 404c43c4 2018-06-21 stsp blame = calloc(1, sizeof(*blame));
190 404c43c4 2018-06-21 stsp if (blame == NULL)
191 404c43c4 2018-06-21 stsp return got_error_from_errno();
192 404c43c4 2018-06-21 stsp
193 404c43c4 2018-06-21 stsp blame->f = got_opentemp();
194 404c43c4 2018-06-21 stsp if (blame->f == NULL) {
195 404c43c4 2018-06-21 stsp err = got_error_from_errno();
196 404c43c4 2018-06-21 stsp goto done;
197 404c43c4 2018-06-21 stsp }
198 84451b3e 2018-07-10 stsp err = got_object_blob_dump_to_file(NULL, &blame->nlines, blame->f,
199 84451b3e 2018-07-10 stsp blob);
200 404c43c4 2018-06-21 stsp if (err)
201 404c43c4 2018-06-21 stsp goto done;
202 404c43c4 2018-06-21 stsp
203 404c43c4 2018-06-21 stsp blame->lines = calloc(blame->nlines, sizeof(*blame->lines));
204 404c43c4 2018-06-21 stsp if (blame->lines == NULL) {
205 404c43c4 2018-06-21 stsp err = got_error_from_errno();
206 404c43c4 2018-06-21 stsp goto done;
207 404c43c4 2018-06-21 stsp }
208 404c43c4 2018-06-21 stsp
209 404c43c4 2018-06-21 stsp /* Loop over first-parent history and try to blame commits. */
210 404c43c4 2018-06-21 stsp err = got_object_open_as_commit(&commit, repo, start_commit_id);
211 404c43c4 2018-06-21 stsp if (err)
212 404c43c4 2018-06-21 stsp goto done;
213 404c43c4 2018-06-21 stsp id = got_object_id_dup(start_commit_id);
214 404c43c4 2018-06-21 stsp if (id == NULL) {
215 404c43c4 2018-06-21 stsp err = got_error_from_errno();
216 404c43c4 2018-06-21 stsp goto done;
217 404c43c4 2018-06-21 stsp }
218 404c43c4 2018-06-21 stsp while (1) {
219 404c43c4 2018-06-21 stsp struct got_object_qid *pid;
220 404c43c4 2018-06-21 stsp
221 404c43c4 2018-06-21 stsp pid = SIMPLEQ_FIRST(&commit->parent_ids);
222 404c43c4 2018-06-21 stsp if (pid == NULL)
223 404c43c4 2018-06-21 stsp break;
224 404c43c4 2018-06-21 stsp
225 84451b3e 2018-07-10 stsp err = blame_commit(blame, id, pid->id, path, repo, cb, arg);
226 404c43c4 2018-06-21 stsp if (err) {
227 404c43c4 2018-06-21 stsp if (err->code == GOT_ERR_ITER_COMPLETED)
228 404c43c4 2018-06-21 stsp err = NULL;
229 404c43c4 2018-06-21 stsp break;
230 404c43c4 2018-06-21 stsp }
231 ed77f2ae 2018-06-21 stsp
232 404c43c4 2018-06-21 stsp free(id);
233 404c43c4 2018-06-21 stsp id = got_object_id_dup(pid->id);
234 404c43c4 2018-06-21 stsp if (id == NULL) {
235 404c43c4 2018-06-21 stsp err = got_error_from_errno();
236 404c43c4 2018-06-21 stsp goto done;
237 404c43c4 2018-06-21 stsp }
238 ed77f2ae 2018-06-21 stsp got_object_commit_close(commit);
239 ed77f2ae 2018-06-21 stsp err = got_object_open_as_commit(&commit, repo, id);
240 ed77f2ae 2018-06-21 stsp if (err)
241 84451b3e 2018-07-10 stsp goto done;
242 404c43c4 2018-06-21 stsp }
243 404c43c4 2018-06-21 stsp
244 404c43c4 2018-06-21 stsp /* Annotate remaining non-annotated lines with last commit. */
245 84451b3e 2018-07-10 stsp for (lineno = 1; lineno <= blame->nlines; lineno++) {
246 84451b3e 2018-07-10 stsp err = annotate_line(blame, lineno, id, cb, arg);
247 84451b3e 2018-07-10 stsp if (err)
248 84451b3e 2018-07-10 stsp goto done;
249 84451b3e 2018-07-10 stsp }
250 404c43c4 2018-06-21 stsp
251 404c43c4 2018-06-21 stsp done:
252 404c43c4 2018-06-21 stsp free(id);
253 404c43c4 2018-06-21 stsp if (obj)
254 404c43c4 2018-06-21 stsp got_object_close(obj);
255 404c43c4 2018-06-21 stsp if (blob)
256 404c43c4 2018-06-21 stsp got_object_blob_close(blob);
257 404c43c4 2018-06-21 stsp if (commit)
258 404c43c4 2018-06-21 stsp got_object_commit_close(commit);
259 1828273a 2018-07-09 stsp if (err) {
260 1828273a 2018-07-09 stsp if (blame)
261 1828273a 2018-07-09 stsp blame_close(blame);
262 1828273a 2018-07-09 stsp } else
263 404c43c4 2018-06-21 stsp *blamep = blame;
264 404c43c4 2018-06-21 stsp
265 404c43c4 2018-06-21 stsp return err;
266 404c43c4 2018-06-21 stsp }
267 404c43c4 2018-06-21 stsp
268 404c43c4 2018-06-21 stsp static const struct got_error *
269 404c43c4 2018-06-21 stsp blame_line(struct got_object_id **id, struct got_blame *blame, int lineno)
270 404c43c4 2018-06-21 stsp {
271 404c43c4 2018-06-21 stsp if (lineno < 1 || lineno > blame->nlines)
272 404c43c4 2018-06-21 stsp return got_error(GOT_ERR_RANGE);
273 404c43c4 2018-06-21 stsp *id = &blame->lines[lineno - 1].id;
274 404c43c4 2018-06-21 stsp return NULL;
275 404c43c4 2018-06-21 stsp }
276 404c43c4 2018-06-21 stsp
277 404c43c4 2018-06-21 stsp static char *
278 404c43c4 2018-06-21 stsp parse_next_line(FILE *f, size_t *len)
279 404c43c4 2018-06-21 stsp {
280 404c43c4 2018-06-21 stsp char *line;
281 404c43c4 2018-06-21 stsp size_t linelen;
282 404c43c4 2018-06-21 stsp size_t lineno;
283 404c43c4 2018-06-21 stsp const char delim[3] = { '\0', '\0', '\0'};
284 404c43c4 2018-06-21 stsp
285 404c43c4 2018-06-21 stsp line = fparseln(f, &linelen, &lineno, delim, 0);
286 404c43c4 2018-06-21 stsp if (len)
287 404c43c4 2018-06-21 stsp *len = linelen;
288 404c43c4 2018-06-21 stsp return line;
289 404c43c4 2018-06-21 stsp }
290 404c43c4 2018-06-21 stsp
291 404c43c4 2018-06-21 stsp const struct got_error *
292 404c43c4 2018-06-21 stsp got_blame(const char *path, struct got_object_id *start_commit_id,
293 404c43c4 2018-06-21 stsp struct got_repository *repo, FILE *outfile)
294 404c43c4 2018-06-21 stsp {
295 404c43c4 2018-06-21 stsp const struct got_error *err = NULL;
296 404c43c4 2018-06-21 stsp struct got_blame *blame;
297 404c43c4 2018-06-21 stsp int lineno;
298 404c43c4 2018-06-21 stsp char *abspath;
299 404c43c4 2018-06-21 stsp
300 404c43c4 2018-06-21 stsp if (asprintf(&abspath, "%s%s", path[0] == '/' ? "" : "/", path) == -1)
301 404c43c4 2018-06-21 stsp return got_error_from_errno();
302 404c43c4 2018-06-21 stsp
303 84451b3e 2018-07-10 stsp err = blame_open(&blame, abspath, start_commit_id, repo, NULL, NULL);
304 404c43c4 2018-06-21 stsp if (err) {
305 404c43c4 2018-06-21 stsp free(abspath);
306 404c43c4 2018-06-21 stsp return err;
307 404c43c4 2018-06-21 stsp }
308 404c43c4 2018-06-21 stsp
309 dd031dc0 2018-07-04 stsp for (lineno = 1; lineno <= blame->nlines; lineno++) {
310 404c43c4 2018-06-21 stsp struct got_object_id *id;
311 404c43c4 2018-06-21 stsp char *line, *id_str;
312 404c43c4 2018-06-21 stsp
313 404c43c4 2018-06-21 stsp line = parse_next_line(blame->f, NULL);
314 404c43c4 2018-06-21 stsp if (line == NULL)
315 404c43c4 2018-06-21 stsp break;
316 404c43c4 2018-06-21 stsp
317 404c43c4 2018-06-21 stsp err = blame_line(&id, blame, lineno);
318 404c43c4 2018-06-21 stsp if (err)
319 404c43c4 2018-06-21 stsp break;
320 404c43c4 2018-06-21 stsp
321 404c43c4 2018-06-21 stsp err = got_object_id_str(&id_str, id);
322 404c43c4 2018-06-21 stsp if (err) {
323 404c43c4 2018-06-21 stsp free(line);
324 404c43c4 2018-06-21 stsp break;
325 404c43c4 2018-06-21 stsp }
326 404c43c4 2018-06-21 stsp
327 404c43c4 2018-06-21 stsp fprintf(outfile, "%.8s %s\n", id_str, line);
328 404c43c4 2018-06-21 stsp free(line);
329 404c43c4 2018-06-21 stsp free(id_str);
330 404c43c4 2018-06-21 stsp }
331 404c43c4 2018-06-21 stsp
332 404c43c4 2018-06-21 stsp blame_close(blame);
333 404c43c4 2018-06-21 stsp free(abspath);
334 404c43c4 2018-06-21 stsp return err;
335 404c43c4 2018-06-21 stsp }
336 84451b3e 2018-07-10 stsp
337 84451b3e 2018-07-10 stsp const struct got_error *
338 84451b3e 2018-07-10 stsp got_blame_incremental(const char *path, struct got_object_id *commit_id,
339 84451b3e 2018-07-10 stsp struct got_repository *repo,
340 84451b3e 2018-07-10 stsp const struct got_error *(*cb)(void *, int, int, struct got_object_id *),
341 84451b3e 2018-07-10 stsp void *arg)
342 84451b3e 2018-07-10 stsp {
343 84451b3e 2018-07-10 stsp const struct got_error *err = NULL;
344 84451b3e 2018-07-10 stsp struct got_blame *blame;
345 84451b3e 2018-07-10 stsp char *abspath;
346 84451b3e 2018-07-10 stsp
347 84451b3e 2018-07-10 stsp if (asprintf(&abspath, "%s%s", path[0] == '/' ? "" : "/", path) == -1)
348 84451b3e 2018-07-10 stsp return got_error_from_errno();
349 84451b3e 2018-07-10 stsp
350 84451b3e 2018-07-10 stsp err = blame_open(&blame, abspath, commit_id, repo, cb, arg);
351 84451b3e 2018-07-10 stsp free(abspath);
352 75b7a700 2018-07-10 stsp if (err == NULL)
353 75b7a700 2018-07-10 stsp blame_close(blame);
354 84451b3e 2018-07-10 stsp return err;
355 84451b3e 2018-07-10 stsp }