summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.css66
-rw-r--r--ui-diff.c21
-rw-r--r--ui-ssdiff.c20
-rw-r--r--ui-ssdiff.h3
4 files changed, 88 insertions, 22 deletions
diff --git a/cgit.css b/cgit.css
index bf58b8a..3f37165 100644
--- a/cgit.css
+++ b/cgit.css
@@ -604,5 +604,19 @@ table.hgraph div.bar {
604 604
605table.ssdiff {
606 width: 100%;
607}
608
609table.ssdiff td {
610 font-size: 75%;
611 font-family: monospace;
612 white-space: pre;
613 padding: 1px 4px 1px 4px;
614 border-left: solid 1px #aaa;
615 border-right: solid 1px #aaa;
616}
617
605table.ssdiff td.add { 618table.ssdiff td.add {
606 color: black; 619 color: black;
607 background: #afa; 620 background: #cfc;
621 min-width: 50%;
608} 622}
@@ -611,3 +625,4 @@ table.ssdiff td.add_dark {
611 color: black; 625 color: black;
612 background: #9c9; 626 background: #aca;
627 min-width: 50%;
613} 628}
@@ -616,3 +631,4 @@ table.ssdiff td.del {
616 color: black; 631 color: black;
617 background: #faa; 632 background: #fcc;
633 min-width: 50%;
618} 634}
@@ -621,3 +637,4 @@ table.ssdiff td.del_dark {
621 color: black; 637 color: black;
622 background: #c99; 638 background: #caa;
639 min-width: 50%;
623} 640}
@@ -626,3 +643,4 @@ table.ssdiff td.changed {
626 color: black; 643 color: black;
627 background: #ffa; 644 background: #ffc;
645 min-width: 50%;
628} 646}
@@ -631,3 +649,12 @@ table.ssdiff td.changed_dark {
631 color: black; 649 color: black;
632 background: #cc9; 650 background: #cca;
651 min-width: 50%;
652}
653
654table.ssdiff td.lineno {
655 color: black;
656 background: #eee;
657 text-align: right;
658 width: 3em;
659 min-width: 3em;
633} 660}
@@ -637,2 +664,29 @@ table.ssdiff td.hunk {
637 background: #ccf; 664 background: #ccf;
665 border-top: solid 1px #aaa;
666 border-bottom: solid 1px #aaa;
667}
668
669table.ssdiff td.head {
670 border-top: solid 1px #aaa;
671 border-bottom: solid 1px #aaa;
672}
673
674table.ssdiff td.head div.head {
675 font-weight: bold;
676 color: black;
677}
678
679table.ssdiff td.foot {
680 border-top: solid 1px #aaa;
681 border-left: none;
682 border-right: none;
683 border-bottom: none;
684}
685
686table.ssdiff td.space {
687 border: none;
688}
689
690table.ssdiff td.space div {
691 min-height: 3em;
638} 692}
diff --git a/ui-diff.c b/ui-diff.c
index 42e81ac..b21c2c1 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -248,4 +248,2 @@ static void header(unsigned char *sha1, char *path1, int mode1,
248 html("</div>"); 248 html("</div>");
249 if (use_ssdiff)
250 cgit_ssdiff_header();
251} 249}
@@ -272,13 +270,15 @@ static void filepair_cb(struct diff_filepair *pair)
272 270
273 header(pair->one->sha1, pair->one->path, pair->one->mode,
274 pair->two->sha1, pair->two->path, pair->two->mode);
275 if (use_ssdiff) { 271 if (use_ssdiff) {
276 cgit_ssdiff_header(); 272 cgit_ssdiff_header_begin();
277 print_line_fn = cgit_ssdiff_line_cb; 273 print_line_fn = cgit_ssdiff_line_cb;
278 } 274 }
275 header(pair->one->sha1, pair->one->path, pair->one->mode,
276 pair->two->sha1, pair->two->path, pair->two->mode);
277 if (use_ssdiff)
278 cgit_ssdiff_header_end();
279 if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) { 279 if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) {
280 if (S_ISGITLINK(pair->one->mode)) 280 if (S_ISGITLINK(pair->one->mode))
281 print_line(fmt("-Subproject %s", sha1_to_hex(pair->one->sha1)), 52); 281 print_line_fn(fmt("-Subproject %s", sha1_to_hex(pair->one->sha1)), 52);
282 if (S_ISGITLINK(pair->two->mode)) 282 if (S_ISGITLINK(pair->two->mode))
283 print_line(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52); 283 print_line_fn(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52);
284 return; 284 return;
@@ -289,3 +289,3 @@ static void filepair_cb(struct diff_filepair *pair)
289 if (binary) 289 if (binary)
290 html("Binary files differ"); 290 print_line_fn(" Binary files differ", 20);
291 if (use_ssdiff) 291 if (use_ssdiff)
@@ -336,5 +336,10 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
336 336
337 if (use_ssdiff) {
338 html("<table summary='ssdiff' class='ssdiff'>");
339 } else {
337 html("<table summary='diff' class='diff'>"); 340 html("<table summary='diff' class='diff'>");
338 html("<tr><td>"); 341 html("<tr><td>");
342 }
339 cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb, prefix); 343 cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb, prefix);
344 if (!use_ssdiff)
340 html("</td></tr>"); 345 html("</td></tr>");
diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index 3591ab4..8215051 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -108,6 +108,6 @@ static void print_ssdiff_line(char *class, int old_line_no, char *old_line,
108 if (old_line_no > 0) 108 if (old_line_no > 0)
109 htmlf("<td class='%s'>%d </td><td class='%s'>", class, 109 htmlf("<td class='lineno'>%d</td><td class='%s'>",
110 old_line_no, class); 110 old_line_no, class);
111 else 111 else
112 htmlf("<td class='%s_dark'> </td><td class='%s_dark'>", class, class); 112 htmlf("<td class='lineno'></td><td class='%s_dark'>", class);
113 113
@@ -122,6 +122,6 @@ static void print_ssdiff_line(char *class, int old_line_no, char *old_line,
122 if (new_line_no > 0) 122 if (new_line_no > 0)
123 htmlf("<td class='%s'> %d </td><td class='%s'>", class, 123 htmlf("<td class='lineno'>%d</td><td class='%s'>",
124 new_line_no, class); 124 new_line_no, class);
125 else 125 else
126 htmlf("<td class='%s_dark'> </td><td class='%s_dark'>", class, class); 126 htmlf("<td class='lineno'></td><td class='%s_dark'>", class);
127 127
@@ -251,3 +251,3 @@ void cgit_ssdiff_line_cb(char *line, int len)
251 251
252void cgit_ssdiff_header() 252void cgit_ssdiff_header_begin()
253{ 253{
@@ -255,3 +255,9 @@ void cgit_ssdiff_header()
255 current_new_line = 0; 255 current_new_line = 0;
256 html("<table class='ssdiff'>"); 256 html("<tr><td class='space' colspan='4'><div></div></td></tr>");
257 html("<tr><td class='head' colspan='4'>");
258}
259
260void cgit_ssdiff_header_end()
261{
262 html("</td><tr>");
257} 263}
@@ -262,3 +268,3 @@ void cgit_ssdiff_footer()
262 cgit_ssdiff_print_deferred_lines(); 268 cgit_ssdiff_print_deferred_lines();
263 html("</table>"); 269 html("<tr><td class='foot' colspan='4'></td></tr>");
264} 270}
diff --git a/ui-ssdiff.h b/ui-ssdiff.h
index a0b1efe..64b4b12 100644
--- a/ui-ssdiff.h
+++ b/ui-ssdiff.h
@@ -7,3 +7,4 @@ extern void cgit_ssdiff_line_cb(char *line, int len);
7 7
8extern void cgit_ssdiff_header(); 8extern void cgit_ssdiff_header_begin();
9extern void cgit_ssdiff_header_end();
9 10