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 404c43c4 2018-06-21 stsp #include "got_lib_zbuf.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 404c43c4 2018-06-21 stsp dump_blob_and_count_lines(size_t *nlines, FILE *outfile,
51 404c43c4 2018-06-21 stsp struct got_blob_object *blob)
52 404c43c4 2018-06-21 stsp {
53 404c43c4 2018-06-21 stsp const struct got_error *err = NULL;
54 404c43c4 2018-06-21 stsp size_t len, hdrlen;
55 404c43c4 2018-06-21 stsp const uint8_t *buf;
56 404c43c4 2018-06-21 stsp int i;
57 404c43c4 2018-06-21 stsp
58 404c43c4 2018-06-21 stsp hdrlen = got_object_blob_get_hdrlen(blob);
59 404c43c4 2018-06-21 stsp *nlines = 0;
60 404c43c4 2018-06-21 stsp do {
61 404c43c4 2018-06-21 stsp err = got_object_blob_read_block(&len, blob);
62 404c43c4 2018-06-21 stsp if (err)
63 404c43c4 2018-06-21 stsp return err;
64 404c43c4 2018-06-21 stsp if (len == 0)
65 404c43c4 2018-06-21 stsp break;
66 404c43c4 2018-06-21 stsp buf = got_object_blob_get_read_buf(blob);
67 404c43c4 2018-06-21 stsp for (i = 0; i < len; i++) {
68 404c43c4 2018-06-21 stsp if (buf[i] == '\n')
69 404c43c4 2018-06-21 stsp (*nlines)++;
70 404c43c4 2018-06-21 stsp }
71 404c43c4 2018-06-21 stsp /* Skip blob object header first time around. */
72 404c43c4 2018-06-21 stsp fwrite(buf + hdrlen, len - hdrlen, 1, outfile);
73 404c43c4 2018-06-21 stsp hdrlen = 0;
74 404c43c4 2018-06-21 stsp } while (len != 0);
75 404c43c4 2018-06-21 stsp
76 404c43c4 2018-06-21 stsp
77 404c43c4 2018-06-21 stsp fflush(outfile);
78 404c43c4 2018-06-21 stsp rewind(outfile);
79 404c43c4 2018-06-21 stsp
80 404c43c4 2018-06-21 stsp return NULL;
81 404c43c4 2018-06-21 stsp }
82 404c43c4 2018-06-21 stsp
83 404c43c4 2018-06-21 stsp static const struct got_error *
84 404c43c4 2018-06-21 stsp annotate_line(struct got_blame *blame, int lineno, struct got_object_id *id)
85 404c43c4 2018-06-21 stsp {
86 404c43c4 2018-06-21 stsp struct got_blame_line *line;
87 404c43c4 2018-06-21 stsp
88 404c43c4 2018-06-21 stsp if (lineno < 1 || lineno > blame->nlines)
89 404c43c4 2018-06-21 stsp return got_error(GOT_ERR_RANGE);
90 404c43c4 2018-06-21 stsp
91 404c43c4 2018-06-21 stsp line = &blame->lines[lineno - 1];
92 404c43c4 2018-06-21 stsp if (line->annotated)
93 404c43c4 2018-06-21 stsp return NULL;
94 404c43c4 2018-06-21 stsp
95 404c43c4 2018-06-21 stsp memcpy(&line->id, id, sizeof(line->id));
96 404c43c4 2018-06-21 stsp line->annotated = 1;
97 404c43c4 2018-06-21 stsp return NULL;
98 404c43c4 2018-06-21 stsp }
99 404c43c4 2018-06-21 stsp
100 404c43c4 2018-06-21 stsp static const struct got_error *
101 404c43c4 2018-06-21 stsp blame_commit(struct got_blame *blame, struct got_object_id *id,
102 404c43c4 2018-06-21 stsp struct got_object_id *pid, const char *path, struct got_repository *repo)
103 404c43c4 2018-06-21 stsp {
104 404c43c4 2018-06-21 stsp const struct got_error *err = NULL;
105 404c43c4 2018-06-21 stsp struct got_object *obj = NULL, *pobj = NULL;
106 404c43c4 2018-06-21 stsp struct got_blob_object *blob = NULL, *pblob = NULL;
107 404c43c4 2018-06-21 stsp struct got_diff_changes *changes = NULL;
108 404c43c4 2018-06-21 stsp
109 404c43c4 2018-06-21 stsp err = got_object_open_by_path(&obj, repo, id, path);
110 404c43c4 2018-06-21 stsp if (err)
111 404c43c4 2018-06-21 stsp goto done;
112 404c43c4 2018-06-21 stsp if (got_object_get_type(obj) != GOT_OBJ_TYPE_BLOB) {
113 404c43c4 2018-06-21 stsp err = got_error(GOT_ERR_OBJ_TYPE);
114 404c43c4 2018-06-21 stsp goto done;
115 404c43c4 2018-06-21 stsp }
116 404c43c4 2018-06-21 stsp
117 404c43c4 2018-06-21 stsp err = got_object_open_by_path(&pobj, repo, pid, path);
118 404c43c4 2018-06-21 stsp if (err) {
119 404c43c4 2018-06-21 stsp if (err->code == GOT_ERR_NO_OBJ) {
120 404c43c4 2018-06-21 stsp /* Blob's history began in previous commit. */
121 404c43c4 2018-06-21 stsp err = got_error(GOT_ERR_ITER_COMPLETED);
122 404c43c4 2018-06-21 stsp }
123 404c43c4 2018-06-21 stsp goto done;
124 404c43c4 2018-06-21 stsp }
125 404c43c4 2018-06-21 stsp if (got_object_get_type(pobj) != GOT_OBJ_TYPE_BLOB) {
126 404c43c4 2018-06-21 stsp /*
127 404c43c4 2018-06-21 stsp * Encountered a non-blob at the path (probably a tree).
128 404c43c4 2018-06-21 stsp * Blob's history began in previous commit.
129 404c43c4 2018-06-21 stsp */
130 404c43c4 2018-06-21 stsp err = got_error(GOT_ERR_ITER_COMPLETED);
131 404c43c4 2018-06-21 stsp goto done;
132 404c43c4 2018-06-21 stsp }
133 404c43c4 2018-06-21 stsp
134 404c43c4 2018-06-21 stsp /* If blob hashes match then don't bother with diffing. */
135 404c43c4 2018-06-21 stsp if (got_object_id_cmp(&obj->id, &pobj->id) == 0)
136 404c43c4 2018-06-21 stsp goto done;
137 404c43c4 2018-06-21 stsp
138 404c43c4 2018-06-21 stsp err = got_object_blob_open(&blob, repo, obj, 8192);
139 404c43c4 2018-06-21 stsp if (err)
140 404c43c4 2018-06-21 stsp goto done;
141 404c43c4 2018-06-21 stsp
142 404c43c4 2018-06-21 stsp err = got_object_blob_open(&pblob, repo, pobj, 8192);
143 404c43c4 2018-06-21 stsp if (err)
144 404c43c4 2018-06-21 stsp goto done;
145 404c43c4 2018-06-21 stsp
146 404c43c4 2018-06-21 stsp err = got_diff_blob_lines_changed(&changes, blob, pblob);
147 404c43c4 2018-06-21 stsp if (err)
148 404c43c4 2018-06-21 stsp goto done;
149 404c43c4 2018-06-21 stsp
150 404c43c4 2018-06-21 stsp if (changes) {
151 404c43c4 2018-06-21 stsp struct got_diff_change *change;
152 404c43c4 2018-06-21 stsp char *id_str;
153 404c43c4 2018-06-21 stsp err = got_object_id_str(&id_str, id);
154 404c43c4 2018-06-21 stsp if (err)
155 404c43c4 2018-06-21 stsp goto done;
156 404c43c4 2018-06-21 stsp
157 404c43c4 2018-06-21 stsp SIMPLEQ_FOREACH(change, &changes->entries, entry) {
158 404c43c4 2018-06-21 stsp int a = change->cv.a;
159 404c43c4 2018-06-21 stsp int b = change->cv.b;
160 404c43c4 2018-06-21 stsp int lineno;
161 404c43c4 2018-06-21 stsp for (lineno = a; lineno <= b; lineno++) {
162 404c43c4 2018-06-21 stsp err = annotate_line(blame, lineno, id);
163 404c43c4 2018-06-21 stsp if (err)
164 404c43c4 2018-06-21 stsp goto done;
165 404c43c4 2018-06-21 stsp }
166 404c43c4 2018-06-21 stsp }
167 404c43c4 2018-06-21 stsp free(id_str);
168 404c43c4 2018-06-21 stsp }
169 404c43c4 2018-06-21 stsp done:
170 404c43c4 2018-06-21 stsp if (obj)
171 404c43c4 2018-06-21 stsp got_object_close(obj);
172 404c43c4 2018-06-21 stsp if (pobj)
173 404c43c4 2018-06-21 stsp got_object_close(pobj);
174 404c43c4 2018-06-21 stsp if (blob)
175 404c43c4 2018-06-21 stsp got_object_blob_close(blob);
176 404c43c4 2018-06-21 stsp if (pblob)
177 404c43c4 2018-06-21 stsp got_object_blob_close(pblob);
178 404c43c4 2018-06-21 stsp return err;
179 404c43c4 2018-06-21 stsp }
180 404c43c4 2018-06-21 stsp
181 404c43c4 2018-06-21 stsp static void
182 404c43c4 2018-06-21 stsp blame_close(struct got_blame *blame)
183 404c43c4 2018-06-21 stsp {
184 404c43c4 2018-06-21 stsp if (blame->f)
185 404c43c4 2018-06-21 stsp fclose(blame->f);
186 404c43c4 2018-06-21 stsp free(blame->lines);
187 404c43c4 2018-06-21 stsp free(blame);
188 404c43c4 2018-06-21 stsp }
189 404c43c4 2018-06-21 stsp
190 404c43c4 2018-06-21 stsp static const struct got_error *
191 404c43c4 2018-06-21 stsp blame_open(struct got_blame **blamep, const char *path,
192 404c43c4 2018-06-21 stsp struct got_object_id *start_commit_id, struct got_repository *repo)
193 404c43c4 2018-06-21 stsp {
194 404c43c4 2018-06-21 stsp const struct got_error *err = NULL;
195 404c43c4 2018-06-21 stsp struct got_object *obj = NULL;
196 404c43c4 2018-06-21 stsp struct got_blob_object *blob = NULL;
197 404c43c4 2018-06-21 stsp struct got_blame *blame = NULL;
198 404c43c4 2018-06-21 stsp struct got_commit_object *commit = NULL;
199 404c43c4 2018-06-21 stsp struct got_object_id *id = NULL;
200 404c43c4 2018-06-21 stsp int lineno;
201 404c43c4 2018-06-21 stsp
202 404c43c4 2018-06-21 stsp *blamep = NULL;
203 404c43c4 2018-06-21 stsp
204 404c43c4 2018-06-21 stsp err = got_object_open_by_path(&obj, repo, start_commit_id, path);
205 404c43c4 2018-06-21 stsp if (err)
206 404c43c4 2018-06-21 stsp return err;
207 404c43c4 2018-06-21 stsp if (got_object_get_type(obj) != GOT_OBJ_TYPE_BLOB) {
208 404c43c4 2018-06-21 stsp err = got_error(GOT_ERR_OBJ_TYPE);
209 404c43c4 2018-06-21 stsp goto done;
210 404c43c4 2018-06-21 stsp }
211 404c43c4 2018-06-21 stsp
212 404c43c4 2018-06-21 stsp err = got_object_blob_open(&blob, repo, obj, 8192);
213 404c43c4 2018-06-21 stsp if (err)
214 404c43c4 2018-06-21 stsp goto done;
215 404c43c4 2018-06-21 stsp
216 404c43c4 2018-06-21 stsp blame = calloc(1, sizeof(*blame));
217 404c43c4 2018-06-21 stsp if (blame == NULL)
218 404c43c4 2018-06-21 stsp return got_error_from_errno();
219 404c43c4 2018-06-21 stsp
220 404c43c4 2018-06-21 stsp blame->f = got_opentemp();
221 404c43c4 2018-06-21 stsp if (blame->f == NULL) {
222 404c43c4 2018-06-21 stsp err = got_error_from_errno();
223 404c43c4 2018-06-21 stsp goto done;
224 404c43c4 2018-06-21 stsp }
225 404c43c4 2018-06-21 stsp err = dump_blob_and_count_lines(&blame->nlines, blame->f, blob);
226 404c43c4 2018-06-21 stsp if (err)
227 404c43c4 2018-06-21 stsp goto done;
228 404c43c4 2018-06-21 stsp
229 404c43c4 2018-06-21 stsp blame->lines = calloc(blame->nlines, sizeof(*blame->lines));
230 404c43c4 2018-06-21 stsp if (blame->lines == NULL) {
231 404c43c4 2018-06-21 stsp err = got_error_from_errno();
232 404c43c4 2018-06-21 stsp goto done;
233 404c43c4 2018-06-21 stsp }
234 404c43c4 2018-06-21 stsp
235 404c43c4 2018-06-21 stsp /* Loop over first-parent history and try to blame commits. */
236 404c43c4 2018-06-21 stsp err = got_object_open_as_commit(&commit, repo, start_commit_id);
237 404c43c4 2018-06-21 stsp if (err)
238 404c43c4 2018-06-21 stsp goto done;
239 404c43c4 2018-06-21 stsp id = got_object_id_dup(start_commit_id);
240 404c43c4 2018-06-21 stsp if (id == NULL) {
241 404c43c4 2018-06-21 stsp err = got_error_from_errno();
242 404c43c4 2018-06-21 stsp goto done;
243 404c43c4 2018-06-21 stsp }
244 404c43c4 2018-06-21 stsp while (1) {
245 404c43c4 2018-06-21 stsp struct got_object_qid *pid;
246 404c43c4 2018-06-21 stsp struct got_commit_object *pcommit;
247 404c43c4 2018-06-21 stsp
248 404c43c4 2018-06-21 stsp pid = SIMPLEQ_FIRST(&commit->parent_ids);
249 404c43c4 2018-06-21 stsp if (pid == NULL)
250 404c43c4 2018-06-21 stsp break;
251 404c43c4 2018-06-21 stsp
252 404c43c4 2018-06-21 stsp err = got_object_open_as_commit(&pcommit, repo, pid->id);
253 404c43c4 2018-06-21 stsp if (err)
254 404c43c4 2018-06-21 stsp break;
255 404c43c4 2018-06-21 stsp
256 404c43c4 2018-06-21 stsp err = blame_commit(blame, id, pid->id, path, repo);
257 404c43c4 2018-06-21 stsp if (err) {
258 404c43c4 2018-06-21 stsp if (err->code == GOT_ERR_ITER_COMPLETED)
259 404c43c4 2018-06-21 stsp err = NULL;
260 404c43c4 2018-06-21 stsp got_object_commit_close(pcommit);
261 404c43c4 2018-06-21 stsp break;
262 404c43c4 2018-06-21 stsp }
263 404c43c4 2018-06-21 stsp free(id);
264 404c43c4 2018-06-21 stsp id = got_object_id_dup(pid->id);
265 404c43c4 2018-06-21 stsp got_object_commit_close(commit);
266 404c43c4 2018-06-21 stsp commit = pcommit;
267 404c43c4 2018-06-21 stsp if (id == NULL) {
268 404c43c4 2018-06-21 stsp err = got_error_from_errno();
269 404c43c4 2018-06-21 stsp goto done;
270 404c43c4 2018-06-21 stsp }
271 404c43c4 2018-06-21 stsp }
272 404c43c4 2018-06-21 stsp
273 404c43c4 2018-06-21 stsp /* Annotate remaining non-annotated lines with last commit. */
274 404c43c4 2018-06-21 stsp for (lineno = 1; lineno < blame->nlines; lineno++) {
275 404c43c4 2018-06-21 stsp err = annotate_line(blame, lineno, id);
276 404c43c4 2018-06-21 stsp if (err)
277 404c43c4 2018-06-21 stsp break;
278 404c43c4 2018-06-21 stsp }
279 404c43c4 2018-06-21 stsp
280 404c43c4 2018-06-21 stsp done:
281 404c43c4 2018-06-21 stsp free(id);
282 404c43c4 2018-06-21 stsp if (obj)
283 404c43c4 2018-06-21 stsp got_object_close(obj);
284 404c43c4 2018-06-21 stsp if (blob)
285 404c43c4 2018-06-21 stsp got_object_blob_close(blob);
286 404c43c4 2018-06-21 stsp if (commit)
287 404c43c4 2018-06-21 stsp got_object_commit_close(commit);
288 404c43c4 2018-06-21 stsp if (err)
289 404c43c4 2018-06-21 stsp blame_close(blame);
290 404c43c4 2018-06-21 stsp else
291 404c43c4 2018-06-21 stsp *blamep = blame;
292 404c43c4 2018-06-21 stsp
293 404c43c4 2018-06-21 stsp return err;
294 404c43c4 2018-06-21 stsp }
295 404c43c4 2018-06-21 stsp
296 404c43c4 2018-06-21 stsp static const struct got_error *
297 404c43c4 2018-06-21 stsp blame_line(struct got_object_id **id, struct got_blame *blame, int lineno)
298 404c43c4 2018-06-21 stsp {
299 404c43c4 2018-06-21 stsp if (lineno < 1 || lineno > blame->nlines)
300 404c43c4 2018-06-21 stsp return got_error(GOT_ERR_RANGE);
301 404c43c4 2018-06-21 stsp *id = &blame->lines[lineno - 1].id;
302 404c43c4 2018-06-21 stsp return NULL;
303 404c43c4 2018-06-21 stsp }
304 404c43c4 2018-06-21 stsp
305 404c43c4 2018-06-21 stsp static char *
306 404c43c4 2018-06-21 stsp parse_next_line(FILE *f, size_t *len)
307 404c43c4 2018-06-21 stsp {
308 404c43c4 2018-06-21 stsp char *line;
309 404c43c4 2018-06-21 stsp size_t linelen;
310 404c43c4 2018-06-21 stsp size_t lineno;
311 404c43c4 2018-06-21 stsp const char delim[3] = { '\0', '\0', '\0'};
312 404c43c4 2018-06-21 stsp
313 404c43c4 2018-06-21 stsp line = fparseln(f, &linelen, &lineno, delim, 0);
314 404c43c4 2018-06-21 stsp if (len)
315 404c43c4 2018-06-21 stsp *len = linelen;
316 404c43c4 2018-06-21 stsp return line;
317 404c43c4 2018-06-21 stsp }
318 404c43c4 2018-06-21 stsp
319 404c43c4 2018-06-21 stsp const struct got_error *
320 404c43c4 2018-06-21 stsp got_blame(const char *path, struct got_object_id *start_commit_id,
321 404c43c4 2018-06-21 stsp struct got_repository *repo, FILE *outfile)
322 404c43c4 2018-06-21 stsp {
323 404c43c4 2018-06-21 stsp const struct got_error *err = NULL;
324 404c43c4 2018-06-21 stsp struct got_blame *blame;
325 404c43c4 2018-06-21 stsp int lineno;
326 404c43c4 2018-06-21 stsp char *abspath;
327 404c43c4 2018-06-21 stsp
328 404c43c4 2018-06-21 stsp if (asprintf(&abspath, "%s%s", path[0] == '/' ? "" : "/", path) == -1)
329 404c43c4 2018-06-21 stsp return got_error_from_errno();
330 404c43c4 2018-06-21 stsp
331 404c43c4 2018-06-21 stsp err = blame_open(&blame, abspath, start_commit_id, repo);
332 404c43c4 2018-06-21 stsp if (err) {
333 404c43c4 2018-06-21 stsp free(abspath);
334 404c43c4 2018-06-21 stsp return err;
335 404c43c4 2018-06-21 stsp }
336 404c43c4 2018-06-21 stsp
337 404c43c4 2018-06-21 stsp for (lineno = 1; lineno < blame->nlines; lineno++) {
338 404c43c4 2018-06-21 stsp struct got_object_id *id;
339 404c43c4 2018-06-21 stsp char *line, *id_str;
340 404c43c4 2018-06-21 stsp
341 404c43c4 2018-06-21 stsp line = parse_next_line(blame->f, NULL);
342 404c43c4 2018-06-21 stsp if (line == NULL)
343 404c43c4 2018-06-21 stsp break;
344 404c43c4 2018-06-21 stsp
345 404c43c4 2018-06-21 stsp err = blame_line(&id, blame, lineno);
346 404c43c4 2018-06-21 stsp if (err)
347 404c43c4 2018-06-21 stsp break;
348 404c43c4 2018-06-21 stsp
349 404c43c4 2018-06-21 stsp err = got_object_id_str(&id_str, id);
350 404c43c4 2018-06-21 stsp if (err) {
351 404c43c4 2018-06-21 stsp free(line);
352 404c43c4 2018-06-21 stsp break;
353 404c43c4 2018-06-21 stsp }
354 404c43c4 2018-06-21 stsp
355 404c43c4 2018-06-21 stsp fprintf(outfile, "%.8s %s\n", id_str, line);
356 404c43c4 2018-06-21 stsp free(line);
357 404c43c4 2018-06-21 stsp free(id_str);
358 404c43c4 2018-06-21 stsp }
359 404c43c4 2018-06-21 stsp
360 404c43c4 2018-06-21 stsp blame_close(blame);
361 404c43c4 2018-06-21 stsp free(abspath);
362 404c43c4 2018-06-21 stsp return err;
363 404c43c4 2018-06-21 stsp }