From a0dbff9161f92990ff07e8728ad07dfe16c3aef1 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Mon, 7 Dec 2015 21:34:53 +0100 Subject: [PATCH] performance tweak: check if commit file exists, if so skip --- urmoms.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/urmoms.c b/urmoms.c index 5e10a2f..159e095 100644 --- a/urmoms.c +++ b/urmoms.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "git2.h" @@ -218,10 +219,13 @@ printshowfile(git_commit *commit) git_oid_tostr(buf, sizeof(buf), git_commit_id(commit)); snprintf(path, sizeof(path), "commit/%s.html", buf); - fp = efopen(path, "w+b"); + /* check if file exists if so skip it */ + if (!access(path, F_OK)) + return; memset(&diffstatsbuf, 0, sizeof(diffstatsbuf)); + fp = efopen(path, "w+b"); writeheader(fp); printcommit(fp, commit); -- libgit2 1.1.1