jesseduffield.lazygit/pkg/integration/tests
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
..
bisect Make bisect/basic.go test more concrete 2023-07-31 08:34:01 +02:00
branch Add integration test for local branch sort order 2023-12-27 15:25:29 +01:00
cherry_pick Allow cherry-picking commits during a rebase 2023-09-18 10:50:19 +02:00
commit Preserve the commit message correctly even if the description has blank lines 2024-01-09 14:31:53 +01:00
config Support matchers on integers in integration tests 2023-06-03 15:32:23 +10:00
conflicts Construct arg vector manually rather than parse string 2023-05-23 19:49:19 +10:00
custom_commands Allow checking for merge conflicts after running a custom command 2023-07-13 18:40:34 +10:00
demo Add demo for diffing two commits 2023-08-12 17:24:05 +10:00
diff Add busy count for integration tests 2023-07-08 22:54:52 +10:00
file feat: introduce a copy menu into the file view 2023-12-07 08:30:03 +01:00
filter_and_search When refreshing models, re-apply active filter for the corresponding view 2023-10-10 08:37:30 +02:00
filter_by_path Use sentence case everywhere 2023-05-25 23:52:19 +10:00
interactive_rebase Improve prompts when amending commits 2023-09-01 18:55:16 +02:00
misc fixed typo in test description 2023-10-30 14:17:34 +01:00
patch_building feat: add os.copyToClipboardCmd to allow for a custom command #1055 (#2784) 2023-07-29 19:35:52 +10:00
reflog Don't show branch heads in reflog subcommits 2023-07-31 08:34:01 +02:00
shared Construct arg vector manually rather than parse string 2023-05-23 19:49:19 +10:00
staging Fix the title and text (and variable names) of the Discard Changes prompt 2023-06-26 08:15:35 +02:00
stash feat: add age on stash lines 2023-12-27 11:21:49 +01:00
submodule Use sentence case everywhere 2023-05-25 23:52:19 +10:00
sync Show correct keybindings in force-push prompt 2023-07-31 11:38:52 +02:00
tag Fix checking out a tag when a branch with the same name exists 2024-01-09 14:18:35 +01:00
ui If OpenLink errors, show a dialog instead 2023-08-09 13:12:40 +01:00
undo Use sentence case everywhere 2023-05-25 23:52:19 +10:00
worktree Allow deleting remote tags/branches from local tag/branch views (#2738) 2023-08-10 17:39:26 +10:00
test_list.go Add test demonstrating a bug with preserving the commit message 2024-01-09 14:31:53 +01:00
test_list_generator.go Make test_list_generator.go print what it's doing 2023-09-29 20:40:15 +02:00
tests.go Standardise on using lo for slice functions 2023-07-30 18:51:23 +10:00