1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-08 04:04:22 +02:00
lazygit/pkg
Stefan Haller cd50c79ae4 Preserve the commit message correctly even if the description has blank lines
There are two possible fixes for this bug, and they differ in behavior when
rewording a commit. The one I chose here always splits at the first line feed,
which means that for an improperly formatted commit message such as this one:

   This is a very long multi-line subject,
   which you shouldn't really use in git.

   And this is the body (we call it "description" in lazygit).

we split after the first line instead of after the first paragraph. This is
arguably not what the original author meant, but splitting after the first
paragraph doesn't really work well in lazygit, because we would try to put both
lines into the one-line subject field of the message panel, and you'd only see
the second and not even know that there are more.

The other potential fix would have been to join subject and description with two
line feeds instead of one in JoinCommitMessageAndDescription; this would have
fixed our bug in the same way, but would result in splitting the above message
after the second line instead of the first. I think that's worse, so I decided
for the first fix.

While we're at it, simplify the code a little bit; strings.Cut is documented to
return (s, "") when the separator is not found, so there's no need to do this on
our side.

We do have to trim spaces on the description now, to support the regular reword
case where subject and body are separated by a blank line.
2024-01-09 14:31:53 +01:00
..
app Show a friendly error message when starting lazygit from a non-existent cwd 2024-01-02 18:25:28 +00:00
cheatsheet Use go:generate for generating cheatsheets 2023-09-29 20:38:29 +02:00
commands Simplify GetCommitMessage 2024-01-09 14:31:53 +01:00
common Add AppState to common.Common 2023-09-04 17:48:39 +02:00
config Add command to open git difftool 2024-01-09 14:27:33 +01:00
constants
env Support bare worktrees where worktree does not have its own .git file 2023-08-07 22:40:53 +10:00
fakes
gui Preserve the commit message correctly even if the description has blank lines 2024-01-09 14:31:53 +01:00
i18n Add command to open git difftool 2024-01-09 14:27:33 +01:00
integration Preserve the commit message correctly even if the description has blank lines 2024-01-09 14:31:53 +01:00
jsonschema Add UserConfig jsonschema generation script 2023-12-02 10:46:24 +01:00
logs Remove secureexec package 2023-07-30 19:59:51 +10:00
snake
tasks Remove secureexec package 2023-07-30 19:59:51 +10:00
theme Add a "Mark commit as base commit for rebase" command 2023-07-31 08:41:41 +02:00
updates Construct arg vector manually rather than parse string 2023-05-23 19:49:19 +10:00
utils Pass "now" into utils.Loader 2023-10-16 09:03:07 +02:00