josa42 / atom-blame

Show git blame as a gutter in Atom editor

Home Page:https://atom.io/packages/blame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi-line commit messages shown as one line

aharpervc opened this issue · comments

I have a lot of commits in the form

shorter commit title
- longer commit explanation
- with several line breaks

Right now this extension shows everything in 1 long line, which is sometimes larger than the editor window is wide so it gets cut off.

It would be better to make sure line breaks are processed in the tooltip the same as in the commit message.

I am not so sure what's the right solution for this.

Actually, its common to have a new line between subject and description.

Though not required, it’s a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description.

Source: git-commit Reference

Git also does the same thing:

screen shot 2016-01-28 at 10 10 26

On the other hand, github treats the same message like this:

screen shot 2016-01-28 at 10 12 28

If the tooltips looked like GitHub that'd be great

I see that you published a new version... looks great 👍

I spoke too soon. There's still a case where multiline commits show up as one line in the tooltip and get ellipsis'd. It's in the form: main first line\n- longer second line. Interestingly, other multiline commits look fine.

The only thing I did was to make sure the tooltip doesn't get to wide.

The other issue is not that easy. For the parsing the commit message I currently use git itself.

For this message:

shorter commit title
- longer commit explanation
- with several line breaks

Git returns this:

let subject = "shorter commit title - longer commit explanation - with several line breaks"
let message = ""

If you would have added a newline between subject and message, like it is recommended in the git man:

shorter commit title

- longer commit explanation
- with several line breaks

Git returns the desired result:

let subject = "shorter commit title"
let message = " - longer commit explanation\n - with several line breaks"

So in my opinion it is absolutely right the way it is right now.

Are you saying that git isn't telling you that there's a \n after the word title in your example? If there's no \n, then I guess git is busted. If there is a \n, then I believe the tooltip should render it as a line break. I wonder how GitHub is able to figure out that a line break should be presented...

What I am saying is, that since you have no blank line between subject and body, git considers it all to be the subject. In the subject all newlines get eliminated.

I am pretty sure this is on purpose. Since a subject is not supposed to have newlines.

I the body newlines are shown just fine.

I wonder how GitHub figures it out?

You can always take the first line of the raw commit.

perfect 👍