From 682552378f974f2ca2373951fbc86512bfb32ead Mon Sep 17 00:00:00 2001
From: wxiaoguang <wxiaoguang@gmail.com>
Date: Mon, 4 Sep 2023 21:38:59 +0800
Subject: [PATCH] More fixes for the "commit-body" (#26898)

The changes for "commit-body" in #26877 are not ideal.

The reason is: the "commit-body" is usually a `<pre>`, it has default
margins. In most cases, we do not need that large margin. So, this PR
introduces a general but small margin for all "commit-body" elements.
Then these `gt-m-0` could be removed.

The `:not` selector is not needed, because the `.timeline-item` selector
is already clear enough.
---
 templates/repo/commit_page.tmpl  | 2 +-
 templates/repo/commits_list.tmpl | 2 +-
 web_src/css/repo.css             | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl
index 06b8f1ba15..612c0f94ca 100644
--- a/templates/repo/commit_page.tmpl
+++ b/templates/repo/commit_page.tmpl
@@ -135,7 +135,7 @@
 				{{end}}
 			</div>
 			{{if IsMultilineCommitMessage .Commit.Message}}
-				<pre class="commit-body gt-mt-0">{{RenderCommitBody $.Context .Commit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
+				<pre class="commit-body">{{RenderCommitBody $.Context .Commit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
 			{{end}}
 			{{template "repo/commit_load_branches_and_tags" .}}
 		</div>
diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl
index b9d0e61713..a06c425b73 100644
--- a/templates/repo/commits_list.tmpl
+++ b/templates/repo/commits_list.tmpl
@@ -68,7 +68,7 @@
 							{{end}}
 							{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}}
 							{{if IsMultilineCommitMessage .Message}}
-							<pre class="commit-body gt-m-0 gt-hidden">{{RenderCommitBody $.Context .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
+							<pre class="commit-body gt-hidden">{{RenderCommitBody $.Context .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
 							{{end}}
 						</td>
 						{{if .Committer}}
diff --git a/web_src/css/repo.css b/web_src/css/repo.css
index 242682593e..fb85a53ab7 100644
--- a/web_src/css/repo.css
+++ b/web_src/css/repo.css
@@ -2620,13 +2620,14 @@ tbody.commit-list {
 }
 
 .commit-body {
+  margin: 0.25em 0;
   white-space: pre-wrap;
   line-height: initial;
 }
 
 /* PR-comment */
-.repository:not(.diff) .timeline-item .commit-body {
-  margin-left: 40px;
+.repository .timeline-item .commit-body {
+  margin-left: 45px;
 }
 
 .git-notes.top {