diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-12-07 21:34:53 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-12-07 21:34:53 +0100 |
commit | a0dbff9161f92990ff07e8728ad07dfe16c3aef1 (patch) | |
tree | 06b93708be27bfab71b5c7999df576f72de17690 /urmoms.c | |
parent | 8de7a32f0744acd6a8279470861440bd287a1bd4 (diff) |
performance tweak: check if commit file exists, if so skip
Diffstat (limited to 'urmoms.c')
-rw-r--r-- | urmoms.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -7,6 +7,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #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); |