");
html("");
@@ -242,11 +229,6 @@ static void header(unsigned char *sha1, char *path1, int mode1,
html(" b/");
html_txt(path2);
- if (is_null_sha1(sha1))
- path1 = "dev/null";
- if (is_null_sha1(sha2))
- path2 = "dev/null";
-
if (mode1 == 0)
htmlf("
new file mode %.6o", mode2);
@@ -264,13 +246,21 @@ static void header(unsigned char *sha1, char *path1, int mode1,
if (mode2 != mode1)
htmlf("..%.6o", mode2);
}
- html("
--- a/");
+ if (is_null_sha1(sha1)) {
+ path1 = "dev/null";
+ html("
--- /");
+ } else
+ html("
--- a/");
if (mode1 != 0)
cgit_tree_link(path1, NULL, NULL, ctx.qry.head,
sha1_to_hex(old_rev_sha1), path1);
else
html_txt(path1);
- html("
+++ b/");
+ if (is_null_sha1(sha2)) {
+ path2 = "dev/null";
+ html("
+++ /");
+ } else
+ html("
+++ b/");
if (mode2 != 0)
cgit_tree_link(path2, NULL, NULL, ctx.qry.head,
sha1_to_hex(new_rev_sha1), path2);
@@ -280,19 +270,6 @@ static void header(unsigned char *sha1, char *path1, int mode1,
html("
");
}
-static void print_ssdiff_link()
-{
- if (!strcmp(ctx.qry.page, "diff")) {
- if (use_ssdiff)
- cgit_diff_link("Unidiff", NULL, NULL, ctx.qry.head,
- ctx.qry.sha1, ctx.qry.sha2, ctx.qry.path, 1);
- else
- cgit_diff_link("Side-by-side diff", NULL, NULL,
- ctx.qry.head, ctx.qry.sha1,
- ctx.qry.sha2, ctx.qry.path, 1);
- }
-}
-
static void filepair_cb(struct diff_filepair *pair)
{
unsigned long old_size = 0;
@@ -332,7 +309,54 @@ static void filepair_cb(struct diff_filepair *pair)
cgit_ssdiff_footer();
}
-void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefix)
+void cgit_print_diff_ctrls()
+{
+ int i, curr;
+
+ html("");
+ html("
diff options");
+ html("
");
+ html("
");
+}
+
+void cgit_print_diff(const char *new_rev, const char *old_rev,
+ const char *prefix, int show_ctrls)
{
enum object_type type;
unsigned long size;
@@ -374,7 +398,9 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
use_ssdiff = ctx.qry.has_ssdiff ? ctx.qry.ssdiff : ctx.cfg.ssdiff;
- print_ssdiff_link();
+ if (show_ctrls)
+ cgit_print_diff_ctrls();
+
cgit_print_diffstat(old_rev_sha1, new_rev_sha1, prefix);
if (use_ssdiff) {