remove got_blame() API, now unused
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
diff --git a/include/got_blame.h b/include/got_blame.h
index 39623c4..6075cad 100644
--- a/include/got_blame.h
+++ b/include/got_blame.h
@@ -15,14 +15,7 @@
*/
/*
- * Write an annotated version of a file at a given in-repository path,
- * as found in the commit specified by ID, to the specified output file.
- */
-const struct got_error *got_blame(const char *, struct got_object_id *,
- struct got_repository *, FILE *);
-
-/*
- * Like got_blame() but instead of generating an output file invoke
+ * Blame the blob at the specified path in the specified commit and invoke
* a callback whenever an annotation has been computed for a line.
*
* The callback receives the provided void * argument, the total number
diff --git a/lib/blame.c b/lib/blame.c
index 93f2913..87b1810 100644
--- a/lib/blame.c
+++ b/lib/blame.c
@@ -411,80 +411,6 @@ done:
return err;
}
-static const struct got_error *
-blame_line(struct got_object_id **id, struct got_blame *blame, int lineno)
-{
- if (lineno < 1 || lineno > blame->nlines) {
- *id = NULL;
- return got_error(GOT_ERR_RANGE);
- }
- *id = &blame->lines[lineno - 1].id;
- return NULL;
-}
-
-static char *
-parse_next_line(FILE *f, size_t *len)
-{
- char *line;
- size_t linelen;
- size_t lineno;
- const char delim[3] = { '\0', '\0', '\0'};
-
- line = fparseln(f, &linelen, &lineno, delim, 0);
- if (len)
- *len = linelen;
- return line;
-}
-
-const struct got_error *
-got_blame(const char *path, struct got_object_id *start_commit_id,
- struct got_repository *repo, FILE *outfile)
-{
- const struct got_error *err = NULL, *close_err = NULL;
- struct got_blame *blame;
- int lineno;
- char *abspath;
-
- if (asprintf(&abspath, "%s%s", path[0] == '/' ? "" : "/", path) == -1)
- return got_error_from_errno2("asprintf", path);
-
- err = blame_open(&blame, abspath, start_commit_id, repo, NULL, NULL);
- if (err) {
- free(abspath);
- return err;
- }
-
- for (lineno = 1; lineno <= blame->nlines; lineno++) {
- struct got_object_id *id = NULL;
- char *line, *id_str;
-
- line = parse_next_line(blame->f, NULL);
- if (line == NULL)
- break;
-
- err = blame_line(&id, blame, lineno);
- if (err) {
- free(line);
- break;
- }
-
- err = got_object_id_str(&id_str, id);
- /* Do not free id; It points into blame->lines. */
- if (err) {
- free(line);
- break;
- }
-
- fprintf(outfile, "%.8s %s\n", id_str, line);
- free(line);
- free(id_str);
- }
-
- close_err = blame_close(blame);
- free(abspath);
- return err ? err : close_err;
-}
-
const struct got_error *
got_blame_incremental(const char *path, struct got_object_id *commit_id,
struct got_repository *repo,