stagit

git site generator
Contents

in the diffstat prefix the type of change, allow CSS styling

Hiltjo Posthuma hiltjo@codemadness.org

commit: 38c7e95 parent: b843c2b
2 files changed, 18 insertions(+), 1 deletions(-)
Mstagit.c+16-1
Mstyle.css+2-0
M · stagit.c +16, -1
 1@@ -461,6 +461,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
 2 git_patch *patch;
 3 size_t nhunks,
nhunklines, changed, add, del, total, i, j, k;
 4 char linestr[80];
 5+ int c;
 6
 7 printcommit(fp,
ci);
 8
 9@@ -480,7 +481,21 @@ printshowfile(FILE *fp, struct commitinfo *ci)
10 for (i = 0; i < ci->ndeltas; i++) {
11 delta =
git_patch_get_delta(ci->deltas[i]->patch);
12
13- fprintf(fp, "<tr><td><a
href=\"#h%zu\">", i);
14+ switch
(delta->status) {
15+ case GIT_DELTA_ADDED:
c = 'A'; break;
16+ case
GIT_DELTA_COPIED: c = 'C'; break;
17+ case
GIT_DELTA_DELETED: c = 'D'; break;
18+ case
GIT_DELTA_MODIFIED: c = 'M'; break;
19+ case
GIT_DELTA_RENAMED: c = 'R'; break;
20+ case
GIT_DELTA_TYPECHANGE: c = 'T'; break;
21+ default: c =
' '; break;
22+ }
23+ if (c == '
')
24+ fprintf(fp,
"<tr><td>%c", c);
25+ else
26+ fprintf(fp,
"<tr><td class=\"%c\">%c", c, c);
27+
28+ fprintf(fp,
"</td><td><a href=\"#h%zu\">", i);
29 xmlencode(fp, delta->old_file.path,
strlen(delta->old_file.path));
30 if
(strcmp(delta->old_file.path, delta->new_file.path)) {
31 fputs("
-&gt; ", fp);
M · style.css +2, -0
 1@@ -84,11 +84,13 @@ pre a.h {
 2 color: #00a;
 3 }
 4
 5+.A,
 6 span.i,
 7 pre a.i {
 8 color: #070;
 9 }
10
11+.D,
12 span.d,
13 pre a.d {
14 color: #e00;