| Date: Fri, 23 Jun 2017 12:29:11 +0200
separate commitinfo_getstats from commitinfo_getbyoid
diffstat fields are not used in each view, this is faster.
Diffstat:
M stagit-gopher.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- |
| @@ -238,8 +238,6 @@ commitinfo_getbyoid(const git_oid *id)
opts.flags |= GIT_DIFF_DISABLE_PATHSPEC_MATCH;
if (git_diff_tree_to_tree(&(ci->diff), repo, ci->parent_tree, ci->commit_tree, &opts))
goto err;
- if (commitinfo_getstats(ci) == -1)
- goto err;
return ci;
@@ -678,12 +676,17 @@ writelog(FILE *fp, const git_oid *oid)
/* check if file exists if so skip it */
if (access(path, F_OK)) {
+ /* lookup stats: only required here */
+ if (commitinfo_getstats(ci) == -1)
+ goto err;
+
fpfile = efopen(path, "w");
writeheader(fpfile, ci->summary);
printshowfile(fpfile, ci);
writefooter(fpfile);
fclose(fpfile);
}
+err:
commitinfo_free(ci);
}
git_revwalk_free(w); |