Diff options
-rw-r--r--source/ui-commit.c4
-rwxr-xr-xtests/t0106-commit.sh12
2 files changed, 15 insertions, 1 deletion
diff --git a/source/ui-commit.c b/source/ui-commit.c
index 846dd5d..63f2b7e 100644
--- a/source/ui-commit.c
+++ b/source/ui-commit.c
@@ -270,7 +270,9 @@ void cgit_print_commit(char *hex, const char *prefix)
ctx.page.title = cgit_fmtalloc("%s - %s", info->subject, ctx.page.title);
cgit_print_layout_start();
- cgit_print_diff_ctrls();
+ // An octopus merge draws no diff, so it has no options to offer.
+ if (commit_list_count(commit->parents) < OCTOPUS_PARENTS)
+ cgit_print_diff_ctrls();
html("<table class='commit-info'>\n");
print_ident_row("author", info->author, info->author_email, info->author_date, info->author_tz);
diff --git a/tests/t0106-commit.sh b/tests/t0106-commit.sh
index 7de0a76..5564038 100755
--- a/tests/t0106-commit.sh
+++ b/tests/t0106-commit.sh
@@ -72,4 +72,16 @@ test_expect_success 'a message that is not UTF-8 has its stray bytes replaced' '
! grep "caf$(printf "\351")" tmp
'
+test_expect_success 'an octopus merge, which draws no diff, offers no diff options' '
+ (
+ cd repos/foo &&
+ cid=$(git commit-tree -p HEAD -p HEAD~1 -p HEAD~2 -m octopus HEAD^{tree}) &&
+ git update-ref refs/heads/octopus "$cid"
+ ) &&
+ cgit_query "url=foo/commit&h=octopus" >tmp &&
+ ! grep "cgit-panel" tmp &&
+ cgit_query "url=foo/commit" >tmp &&
+ grep "cgit-panel" tmp
+'
+
test_done