1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00
Commit Graph

277 Commits

Author SHA1 Message Date
Jesse Duffield
a9ae5063c2 Fix flakey test
Whenever we perform an action in a test, we should assert on the result before doing the next action.
This prevents issues where the test moves too fast for our code. It would be nice to not have to do this,
but for now that's the situation
2023-06-03 15:54:03 +10:00
Jesse Duffield
dd34adb36c Support matchers on integers in integration tests 2023-06-03 15:32:23 +10:00
Jesse Duffield
4ff02bd3b7 Add integration test for commit highlighting on focus
A better refactor would be to allow matchers to assert against either a string or a slice of cells, so that I could have
the same ergonomics that I have elsewhere, but this is a start.
2023-06-01 22:20:30 +10:00
Stefan Haller
16dceb813b Show menu instead of prompt when there are conflicts in a rebase or merge
This solves the issue that previously you could too easily abort a rebase
accidentally by hitting escape.
2023-06-01 10:51:48 +02:00
Jesse Duffield
036a1ea519 Support suggestions generated from command in custom commands
This changes the interface a bit but it was only added earlier today so I doubt anybody is dependent on it yet.

I'm also updating the docs.
2023-05-29 22:47:35 +10:00
Jesse Duffield
16fa22a36e Add suggestionsPreset to custom commands system 2023-05-29 14:24:49 +10:00
Jesse Duffield
d772c9f1d4 Use sentence case everywhere
We have not been good at consistent casing so far. Now we use 'Sentence case' everywhere. EVERYWHERE.

Also Removing 'Lc' prefix from i18n field names: the 'Lc' stood for lowercase but now that everything
is in 'Sentence case' there's no need for the distinction.

I've got a couple lower case things I've kept: namely, things that show up in parentheses.
2023-05-25 23:52:19 +10:00
Jesse Duffield
fb0931e1a1 Fix discard logic
Missed a spot a couple PR's ago. We had an integration test which caught this but which was skipped due
to index.lock file issues. The test was also broken for other reasons due to it not having been running
for a while, so I've fixed that up too.
2023-05-23 20:23:08 +10:00
Jesse Duffield
63dc07fded Construct arg vector manually rather than parse string
By constructing an arg vector manually, we no longer need to quote arguments

Mandate that args must be passed when building a command

Now you need to provide an args array when building a command.
There are a handful of places where we need to deal with a string,
such as with user-defined custom commands, and for those we now require
that at the callsite they use str.ToArgv to do that. I don't want
to provide a method out of the box for it because I want to discourage its
use.

For some reason we were invoking a command through a shell when amending a
commit, and I don't believe we needed to do that as there was nothing user-
supplied about the command. So I've switched to using a regular command out-
side the shell there
2023-05-23 19:49:19 +10:00
Stefan Haller
401610c0ef Remove the toast when toggling "ignore whitespace"
Now that we visualize the state, the toast is no longer needed.
2023-05-20 12:58:32 +10:00
Jesse Duffield
681a9bf20d
Merge pull request #2612 from longlhh90/fix-commit-prefixes-with-empty-commit-message 2023-05-17 17:12:05 +10:00
Lukas
0606b7a43b remove empty message check as message of commit can be empty 2023-05-17 17:07:50 +10:00
Stefan Haller
595c7ee73e Extend one of the filtering tests to start on a commit other than the first
Enabling the filter selects the first entry in the filtered commits view. It's
useful to have a test that checks this, as I almost broke it in the following
commit (it needs an added FocusLine call in the setFiltering function in
filtering_menu_action.go).
2023-05-11 13:23:58 +02:00
Jesse Duffield
2b30085dba Merge branch 'master' into refactor-better-encapsulation 2023-05-11 19:00:01 +10:00
Stefan Haller
d607b366cb Add own version for test move_to_earlier_commit for older git versions 2023-05-02 16:27:32 +02:00
Stefan Haller
c8f26aca68 Rename From to AtLeast 2023-05-02 16:27:32 +02:00
Jesse Duffield
5dacbb6293 merge master into refactor-better-encapsulation 2023-05-02 19:05:42 +10:00
Stefan Haller
fba1a2b5ac Add config gui.experimentalShowBranchHeads
People find the new (*) display for branch heads in the commits list confusing,
so make it opt-in for now.
2023-05-02 18:58:54 +10:00
Jesse Duffield
ee9ae8f07f
Merge pull request #2552 from stefanhaller/support-stacked-branches 2023-05-01 21:07:19 +10:00
Jesse Duffield
a57310df24 Retain commit message when cycling history
When cycling history, we want to make it so that upon returning to the original prompt, you get your text back.
Importantly, we don't want to use the existing preservedMessage field for that because that's only for preserving
a NEW commit message, and we don't want the history stuff of the commit reword flow to overwrite that.
2023-04-30 13:19:54 +10:00
Sean
9d68b287db Split commit message panel into commit summary and commit description panel
When we use the one panel for the entire commit message, its tricky to have a keybinding both for adding a newline and submitting.
By having two panels: one for the summary line and one for the description, we allow for 'enter' to submit the message when done from the summary panel,
and 'enter' to add a newline when done from the description panel. Alt-enter, for those who can use that key combo, also works for submitting the message
from the description panel. For those who can't use that key combo, and don't want to remap the keybinding, they can hit tab to go back to the summary panel
and then 'enter' to submit the message.

We have some awkwardness in that both contexts (i.e. panels) need to appear and disappear in tandem and we don't have a great way of handling that concept,
so we just push both contexts one after the other, and likewise remove both contexts when we escape.
2023-04-30 13:19:53 +10:00
Jesse Duffield
8a86de85c8 remove log call because it clutters test output 2023-04-30 13:19:53 +10:00
Jesse Duffield
2e32e55957 update integration test for toggling whitespace 2023-04-30 13:19:53 +10:00
Jesse Duffield
0cd5257523 Retain commit message when cycling history
When cycling history, we want to make it so that upon returning to the original prompt, you get your text back.
Importantly, we don't want to use the existing preservedMessage field for that because that's only for preserving
a NEW commit message, and we don't want the history stuff of the commit reword flow to overwrite that.
2023-04-30 12:17:34 +10:00
Sean
49da7b482d Split commit message panel into commit summary and commit description panel
When we use the one panel for the entire commit message, its tricky to have a keybinding both for adding a newline and submitting.
By having two panels: one for the summary line and one for the description, we allow for 'enter' to submit the message when done from the summary panel,
and 'enter' to add a newline when done from the description panel. Alt-enter, for those who can use that key combo, also works for submitting the message
from the description panel. For those who can't use that key combo, and don't want to remap the keybinding, they can hit tab to go back to the summary panel
and then 'enter' to submit the message.

We have some awkwardness in that both contexts (i.e. panels) need to appear and disappear in tandem and we don't have a great way of handling that concept,
so we just push both contexts one after the other, and likewise remove both contexts when we escape.
2023-04-30 12:17:34 +10:00
Stefan Haller
3fe4db9316 Make RebaseCommands.AmendTo more robust
This fixes two problems with the "amend commit with staged changes" command:

1. Amending to a fixup commit didn't work (this would create a commmit with the
   title "fixup! fixup! original title" and keep that at the top of the branch)
2. Unrelated fixup commits would be squashed too.

The added integration test verifies that both of these problems are fixed.
2023-04-29 07:28:33 +02:00
Stefan Haller
d50c58b4c6 Implement "edit commit" in terms of the new EditRebase function 2023-04-29 07:28:33 +02:00
Jesse Duffield
aec46942a8 enforce lowercase filenames 2023-04-29 13:05:05 +10:00
AzraelSec
08a445eb9d test: check focus on commits after performing an advanced rebase 2023-04-15 11:01:55 +02:00
Jesse Duffield
8f1f712841 use lowercase text for menu items (as we're still yet to standardise on 'Sentence case') 2023-04-15 17:29:31 +10:00
AzraelSec
b82b6a2992 test: add integration test to verify the interactive rebase correctly work 2023-04-15 17:26:08 +10:00
AzraelSec
3422b1e218 test: update the UI to follow the new rebase type selection instead of confirm the previous popup 2023-04-15 17:26:08 +10:00
Stefan Haller
120dd1530a Make EditRebaseTodo more robust
It used to work on the assumption that rebasing commits in lazygit's model
correspond one-to-one to lines in the git-rebase-todo file, which isn't
necessarily true (e.g. when users use "git rebase --edit-todo" at the custom
command prompt and add a "break" between lines).
2023-04-15 08:36:03 +02:00
Stefan Haller
860a8d102b Add integration test for dropping a todo commit when there's an update-ref
The test shows how we are accidentally dropping the wrong commit in this case.
We'll fix that in the next commit.
2023-04-15 08:36:03 +02:00
Stefan Haller
a304fed68c Add GitVersion field to NewIntegrationTestArgs
It can be used to specify which git versions a given test should or should not run on.
2023-04-15 08:36:03 +02:00
Jesse Duffield
7f5465a27b fix flaky tests 2023-04-14 21:01:45 +10:00
Stefan Haller
6a340ec840 Reorder tests 2023-04-13 19:17:08 +02:00
Stefan Haller
3535cd0f94 Rename test files to match test names 2023-04-13 19:17:08 +02:00
Luka Markušić
2b4ac986a2 Don't add custom command to history if it starts with space
Add tests for custom command with leading space
2023-04-13 21:20:46 +10:00
Stefan Haller
d508badd62 Better error message when trying to amend a commit other than head during rebase 2023-04-01 08:16:15 +02:00
Luka Markušić
e7d0116312 Allow amending the head commit during interactive rebase 2023-04-01 08:16:15 +02:00
Stefan Haller
7513d77567 Add integration test for amending from the files panel 2023-04-01 08:16:15 +02:00
Stefan Haller
c757063264 Better error message when trying to edit or move a non-todo commit during rebase
Previously we would have tried to do the rebase, resulting in a long and
somewhat cryptic error message from git; now we check ourselves and show a less
intimidating message.
2023-04-01 08:16:15 +02:00
Stefan Haller
b24955063c Allow rewording the head commit during interactive rebase 2023-04-01 08:16:15 +02:00
Jesse Duffield
4780953cef
Merge pull request #2377 from shinhs0506/clear-staging-after-commit 2023-03-24 19:13:00 +11:00
Jesse Duffield
8121a0cc74 remove old integration test recording code 2023-03-24 18:42:11 +11:00
John Shin
776d8f4d2e refresh the staging panel on successful commit
apply formatting
2023-03-20 20:13:59 +11:00
Jesse Duffield
7ce3165afa specify view when assertion on line count fails 2023-03-19 16:30:39 +11:00
Stefan Haller
4b4dccfd7d
Fix "move patch into new commit" for partial hunk (#2507) 2023-03-18 18:17:47 +11:00
Stefan Haller
bf6e9a1bd3 Reenable failing test 2023-03-07 09:49:34 +01:00