stagit

static git page generator  https://git.ce9e.org
git clone https://git.ce9e.org/stagit.git

commit
3a151527e1d72aa75d9461ee9918bda3bd08bcb1
parent
608593b0f875012875f13d28fbccd533d1266fd2
Author
Hiltjo Posthuma <hiltjo@codemadness.org>
Date
2018-11-18 17:08
in the diffstat prefix the type of change, allow CSS styling

Diffstat

M stagit.c 17 ++++++++++++++++-
M style.css 2 ++

2 files changed, 18 insertions, 1 deletions


diff --git a/stagit.c b/stagit.c

@@ -461,6 +461,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
  461   461 	git_patch *patch;
  462   462 	size_t nhunks, nhunklines, changed, add, del, total, i, j, k;
  463   463 	char linestr[80];
   -1   464 	int c;
  464   465 
  465   466 	printcommit(fp, ci);
  466   467 
@@ -480,7 +481,21 @@ printshowfile(FILE *fp, struct commitinfo *ci)
  480   481 	for (i = 0; i < ci->ndeltas; i++) {
  481   482 		delta = git_patch_get_delta(ci->deltas[i]->patch);
  482   483 
  483    -1 		fprintf(fp, "<tr><td><a href=\"#h%zu\">", i);
   -1   484 		switch (delta->status) {
   -1   485 		case GIT_DELTA_ADDED:      c = 'A'; break;
   -1   486 		case GIT_DELTA_COPIED:     c = 'C'; break;
   -1   487 		case GIT_DELTA_DELETED:    c = 'D'; break;
   -1   488 		case GIT_DELTA_MODIFIED:   c = 'M'; break;
   -1   489 		case GIT_DELTA_RENAMED:    c = 'R'; break;
   -1   490 		case GIT_DELTA_TYPECHANGE: c = 'T'; break;
   -1   491 		default:                   c = ' '; break;
   -1   492 		}
   -1   493 		if (c == ' ')
   -1   494 			fprintf(fp, "<tr><td>%c", c);
   -1   495 		else
   -1   496 			fprintf(fp, "<tr><td class=\"%c\">%c", c, c);
   -1   497 
   -1   498 		fprintf(fp, "</td><td><a href=\"#h%zu\">", i);
  484   499 		xmlencode(fp, delta->old_file.path, strlen(delta->old_file.path));
  485   500 		if (strcmp(delta->old_file.path, delta->new_file.path)) {
  486   501 			fputs(" -&gt; ", fp);

diff --git a/style.css b/style.css

@@ -84,11 +84,13 @@ pre a.h {
   84    84 	color: #00a;
   85    85 }
   86    86 
   -1    87 .A,
   87    88 span.i,
   88    89 pre a.i {
   89    90 	color: #070;
   90    91 }
   91    92 
   -1    93 .D,
   92    94 span.d,
   93    95 pre a.d {
   94    96 	color: #e00;