tree-diff: simplify tree_entry_pathcmp
[gitweb.git] / builtin / blame.c
index 4916eb2bd26bed670aa3662e790abad9b336ebe3..e44a6bb30a5a5299c6d57150dd2f23454b25891a 100644 (file)
@@ -1803,17 +1803,17 @@ static int prepare_lines(struct scoreboard *sb)
 static int read_ancestry(const char *graft_file)
 {
        FILE *fp = fopen(graft_file, "r");
-       char buf[1024];
+       struct strbuf buf = STRBUF_INIT;
        if (!fp)
                return -1;
-       while (fgets(buf, sizeof(buf), fp)) {
+       while (!strbuf_getwholeline(&buf, fp, '\n')) {
                /* The format is just "Commit Parent1 Parent2 ...\n" */
-               int len = strlen(buf);
-               struct commit_graft *graft = read_graft_line(buf, len);
+               struct commit_graft *graft = read_graft_line(buf.buf, buf.len);
                if (graft)
                        register_commit_graft(graft, 0);
        }
        fclose(fp);
+       strbuf_release(&buf);
        return 0;
 }