Commit messages are not properly formatted. #6202

Closed
opened 2025-11-02 06:48:09 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @typeless on GitHub (Oct 23, 2020).

Description

The long lines in the git commit message are broken inappropriately.
Typically, I use the vim auto-wrapping feature to format the message. (type "gqip" in the normal mode)

As you can see in the screenshot, additional line breaks are inserted between the real lines.

Screenshots

image

Originally created by @typeless on GitHub (Oct 23, 2020). - Gitea version (or commit ref): commit 144fa5a53746387b1c124c10cd7d70cb5cebc26f Date: Wed Oct 7 23:24:41 2020 +0100 Plus https://github.com/go-gitea/gitea/pull/13071. Built from source. - Git version: git version 2.28.0 - Operating system: "18.04.5 LTS (Bionic Beaver)" - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [] No ## Description The long lines in the git commit message are broken inappropriately. Typically, I use the vim auto-wrapping feature to format the message. (type "gqip" in the normal mode) As you can see in the screenshot, additional line breaks are inserted between the *real* lines. ## Screenshots ![image](https://user-images.githubusercontent.com/2606021/96949289-23ddbf00-151a-11eb-95d5-f8822ab3f9db.png)
GiteaMirror added the issue/confirmedtopic/ui labels 2025-11-02 06:48:09 -06:00
Author
Owner

@mrsdizzie commented on GitHub (Oct 23, 2020):

Could you push/reproduce on try for others to see?

@mrsdizzie commented on GitHub (Oct 23, 2020): Could you push/reproduce on try for others to see?
Author
Owner

@typeless commented on GitHub (Oct 24, 2020):

@mrsdizzie
Yes. https://try.gitea.io/typeless/wrapping/commits/branch/master

image

@typeless commented on GitHub (Oct 24, 2020): @mrsdizzie Yes. https://try.gitea.io/typeless/wrapping/commits/branch/master ![image](https://user-images.githubusercontent.com/2606021/97065650-98c7fc00-15e1-11eb-9b2d-8890737aef1b.png)
Author
Owner

@pta2002 commented on GitHub (Oct 25, 2020):

I am not sure if there is any way to fix this other than rewrapping the text before displaying it, which would be quite a complex task since you might not want some things wrapped (e.g. lists). An alternative would be to set overflow-x: scroll on the CSS, which would add a scroll bar to the CSS, or maybe just make this section 80ch wide, which should fit the message.

There seems to be quite a lot of space left over, so it shouldn't be a particularly difficult thing, just a few CSS tweaks. I think I can take a look at this.

@pta2002 commented on GitHub (Oct 25, 2020): I am not sure if there is any way to fix this other than rewrapping the text before displaying it, which would be quite a complex task since you might not want some things wrapped (e.g. lists). An alternative would be to set `overflow-x: scroll` on the CSS, which would add a scroll bar to the CSS, or maybe just make this section `80ch` wide, which should fit the message. There seems to be quite a lot of space left over, so it shouldn't be a particularly difficult thing, just a few CSS tweaks. I think I can take a look at this.
Author
Owner

@pta2002 commented on GitHub (Oct 25, 2020):

image
could also follow GitHub's lead and show it below the other things

@pta2002 commented on GitHub (Oct 25, 2020): ![image](https://user-images.githubusercontent.com/7443916/97115781-956f6600-16f0-11eb-8f2f-0c8591fac223.png) could also follow GitHub's lead and show it below the other things
Author
Owner

@zeripath commented on GitHub (Oct 25, 2020):

I think this would fix it.

From 13a36fa6a803ccbe6ec5aac064ebea48a0479665 Mon Sep 17 00:00:00 2001
From: Andrew Thornton <art27@cantab.net>
Date: Sun, 25 Oct 2020 20:08:38 +0000
Subject: [PATCH] Set overflow-x and white-space: pre for commit-body

Fix #13274

Signed-off-by: Andrew Thornton <art27@cantab.net>
---
 web_src/less/_repository.less | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less
index e84060b06..1db010e88 100644
--- a/web_src/less/_repository.less
+++ b/web_src/less/_repository.less
@@ -3020,7 +3020,8 @@ tbody.commit-list {
 }
 
 .commit-body {
-  white-space: pre-wrap;
+  white-space: pre;
+  overflow-x: scroll;
 }
 
 .git-notes {
-- 
2.25.1

@zeripath commented on GitHub (Oct 25, 2020): I think this would fix it. ```patch From 13a36fa6a803ccbe6ec5aac064ebea48a0479665 Mon Sep 17 00:00:00 2001 From: Andrew Thornton <art27@cantab.net> Date: Sun, 25 Oct 2020 20:08:38 +0000 Subject: [PATCH] Set overflow-x and white-space: pre for commit-body Fix #13274 Signed-off-by: Andrew Thornton <art27@cantab.net> --- web_src/less/_repository.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index e84060b06..1db010e88 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -3020,7 +3020,8 @@ tbody.commit-list { } .commit-body { - white-space: pre-wrap; + white-space: pre; + overflow-x: scroll; } .git-notes { -- 2.25.1 ```
Author
Owner

@pta2002 commented on GitHub (Oct 25, 2020):

Horizontally scrolling is pretty annoying, wouldn't it be better if we could show the commit message body below, like GitHub does it? This would certainly fix the issue, but it'd make it pretty annoying to read having to scroll back and forth.

@pta2002 commented on GitHub (Oct 25, 2020): Horizontally scrolling is pretty annoying, wouldn't it be better if we could show the commit message body below, like GitHub does it? This would certainly fix the issue, but it'd make it pretty annoying to read having to scroll back and forth.
Author
Owner

@mrsdizzie commented on GitHub (Oct 25, 2020):

I think Github style would be better and more readable in general -- current view is already pretty cramped and I don't think horizontal scrolling in a tiny area would be good.

@mrsdizzie commented on GitHub (Oct 25, 2020): I think Github style would be better and more readable in general -- current view is already pretty cramped and I don't think horizontal scrolling in a tiny area would be good.
Author
Owner

@typeless commented on GitHub (Oct 26, 2020):

@pta2002 @mrsdizzie Yeah, I think that is the responsibility of the message author to make it right. That seems to be how Git and the third-party tools should handle the commit messages too. The chances that we are going to be bothered by long lines of commit messages should be slim.

@zeripath Thanks for the patch :) I'll try it out.

@typeless commented on GitHub (Oct 26, 2020): @pta2002 @mrsdizzie Yeah, I think that is the responsibility of the message author to make it right. That seems to be how Git and the third-party tools should handle the commit messages too. The chances that we are going to be bothered by long lines of commit messages should be slim. @zeripath Thanks for the patch :) I'll try it out.
Author
Owner

@yardenshoham commented on GitHub (Nov 16, 2022):

Fixed by #21564?

@yardenshoham commented on GitHub (Nov 16, 2022): Fixed by #21564?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6202