Commit Graph
48 Commits
Author SHA1 Message Date
Stefan HallerandClaude Opus 5.5 280c67ff98 Make "go to bottom" stop at the bad, current and good commits of a bisect
During a bisect, the commits panel shows the commits known to be bad at
the top, the known good ones at the bottom, and the ones that the bisect
hasn't ruled out yet between them. Pressing '>' now stops at the
bottommost bad commit, then at the commit to test, and then at the
topmost good commit.

It doesn't stop at each commit marked good. The commits between two of
them are all good, and they don't form a section of their own.

During a bisect, it also doesn't stop at the beginnings of the other
sections, such as the beginning of a branch. The commits panel doesn't
color the commits by whether they are merged while bisecting, so these
would look like arbitrary commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:08:51 +01:00
Stefan HallerandClaude Opus 5.5 0b87c9e610 Ask git which commits a bisect hasn't ruled out yet
The commits view marks the commits that a bisect hasn't ruled out yet
with a "?". To find them, it looks for the bad commit and the first good
commit in the list, and marks the commits between them. If there's no
good commit in the list, it marks none. This is the case while git
tests the merge base of a good and a bad commit on different branches.
It's also the case early in a long bisect, when the good commit is
further down than the commits that we load. With merges, the commits
between the two can also include some that the bisect has ruled out.

Ask git instead, with "git rev-list <bad> --not <good>...", when
refreshing the commits while git knows both a good and a bad commit.
This takes about as long as the git log that loads the commits, or
less, and it gets faster as the bisect goes on. Keep only the commits
that the commits view has loaded, because git may list many more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 12:17:43 +01:00
Stefan HallerandClaude Opus 5.5 fd7178a3a9 Add tests showing that some commits to bisect lack the "?" mark
The commits view marks the commits between the bad commit and the first
good commit in the list with a "?". If there's no good commit in the
list, it doesn't mark any. This is the case while git tests the merge
base of a good and a bad commit on different branches. It's also the
case early in a long bisect, when the good commit is further down than
the commits that we load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 12:15:16 +01:00
Stefan HallerandClaude Opus 5.5 368633f69c Show the result of a finished bisect instead of the bisect menu
Once git has nothing left to test, the bisect menu offers marking or
skipping the current commit, although the user has marked it already. If
git found the first bad commit without checking out anything to test,
the menu acts on the selected commit instead, as if git didn't know both
a good and a bad commit yet. At this point, the user wants to see the
result and reset the bisect.

Show the "Bisect complete" dialog again instead of the menu. It names
the first bad commit and asks whether to reset the bisect. This also
lets the user see the result again after declining the reset when the
bisect finished.

If git stopped without finding the first bad commit, because the merge
base of the good and the bad commit is bad, show the confirmation for
resetting the bisect. Git said why it stopped when it did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 5284818424 Add tests showing that the bisect menu offers marks once a bisect is done
Once git has nothing left to test, the bisect menu still offers marking
or skipping the current commit, although the user has marked it
already. This also happens if git stopped because the merge base of the
good and the bad commit is bad. If git found the first bad commit
without checking out anything to test, the menu acts on the selected
commit, as if git didn't know both a good and a bad commit yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 ba05949879 Show the mark of the last tested commit once a bisect is done
Once git has nothing left to test, the commit that the user marked last
stays the current commit. The commits view labels it "<-- current",
although git doesn't want the user to test it any more. Show its mark
instead, like for the other marked commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 21569fa96f Add a test showing that a finished bisect labels the last commit "current"
Once git has nothing left to test, the commit that the user marked last
stays the current commit. The commits view labels it "<-- current",
although it is marked good or bad now, and git doesn't want the user to
test it any more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 32d07f2b38 Select the first bad commit once a bisect is done
When the user marks the last commit to test, the commits view keeps it
selected, and the user has to look for the result. The same happens
when lazygit starts after a bisect has finished.

After a mark, git checks out the next commit to test, unless there's
nothing left to test. In that case, the commit that the user marked
last is still the current commit, and the commit marked bad is the
first bad commit. So once the current commit is marked, select the
commit marked bad instead. Do the same if git never checked out a
commit to test, because the good commit is a parent of the bad one.

If only skipped commits are left to test, the first bad commit is
either one of them or the commit marked bad. Select the commit marked
bad then too; it's the newest of the candidates.

The commits view loads the commits down to the commit that it selects,
so this one is always loaded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 e080c08b90 Add tests showing that a finished bisect doesn't select the first bad commit
When the user marks the last commit to test as good, git reports the
commit that is marked bad as the first bad commit. The commits view
keeps the commit that the user just marked selected, though, so the
user has to look for the result. The same happens when lazygit starts
after a bisect has finished.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 350c061081 Focus the commits panel at startup when a bisect is in progress
Lazygit starts in the files panel. During a bisect, this is rarely what
the user needs. The commits panel shows how far the bisect has got, and
the user marks the commits to test there. So start in the commits panel
if a bisect is in progress, even if git doesn't know both a good and a
bad commit yet. The same applies the first time the user switches to
such a repo during a session.

A filter path or a "status", "branch", "log" or "stash" argument still
decides which panel to focus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 e1336f03dd Offer the bisect menu in more views than the commits panel
To start a bisect, users often know that one branch or tag is good and
another one is bad. The bisect menu was available in the commits panel
only, though. To mark the head of another branch, the user had to check
it out first, or find its head commit in the commits panel. The commits
panel shows only the checked-out branch.

Offer the menu in the local branches, remote branches, tags, sub-commits
and reflog views too. There it marks the selected item as good or bad,
and its entries name the item ("branch 'dev'", "tag 'v1.0'"), so that
it's clear what they act on. Once git knows both a good and a bad
commit, the bisect continues in the commits panel. It shows the good and
bad commits and the one to test next, and its menu acts on that one. So
focus the commits panel when a mark in another view gives git the second
of the two, and disable the key in the other views from then on. They
don't offer skipping either.

Name the selected commit "commit <hash>" in the commits panel's menu
too, so that it reads the same in all views.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 eef08f04ec Don't call the selected commit "current" before bisecting starts
After marking the first commit as good or bad, the bisect menu's
entries act on the selected commit until git knows both a good and a
bad commit. They called it the "current commit" though, as if it was
the commit that git wants the user to test.

Call it "commit <hash>" instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 027a5babeb Add a test showing that the bisect menu mislabels the selected commit
After marking the first commit as good or bad, the bisect menu acts on
the selected commit until git knows both a good and a bad commit. Its
entries call that commit the "current commit" though, as if it was the
commit that git wants the user to test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 08065f0294 Load the commits down to the current bisect commit
The commits view loads the first 300 commits only. If the range to
bisect is longer than about 600 commits, the commit that git wants the
user to test is further down than that, so it isn't shown, and we can't
select it.

While bisecting, count the commits in the log above the current commit,
and load that many more than usual.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 990913dd63 Add a test showing that a current bisect commit far down isn't selected
The commits view loads the first 300 commits only. If the range to
bisect is longer than about 600 commits, the commit that git wants the
user to test is further down than that. It isn't loaded, so we can't
select it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 8055f5c139 Show the log of HEAD until both a good and a bad commit are known
Once a bisect had started, the commits view showed the log of the
branch that was checked out when it started, even while git was still
waiting for a good or a bad commit. If the user checked out a different
branch to mark its head as bad, its commits weren't shown.

Keep showing the log of HEAD until git starts checking out commits to
test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 4725e80b34 Add a test showing that a checkout before bisecting doesn't update the log
Once a bisect has started, the commits view shows the log of the branch
that was checked out when it started. This happens even while we don't
know both a good and a bad commit yet, and git hasn't checked out
anything for the user to test. If the user checks out a different
branch to mark its head as bad, the commits view keeps showing the old
branch, so the new branch's head isn't there to be marked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan HallerandClaude Opus 5.5 208bbce33f Select the current bisect commit whenever it changes
If lazygit starts while a bisect is in progress, the commits view
selects the top commit, and the user has to look for the commit that
git wants them to test. The same happens when a git bisect command run
outside of lazygit moves the bisect on.

The bisect menu selected the new current commit after a good, bad or
skip, but only if the selected commit was the current one. It also
needed extra logic to wait for the refresh in case the log was going to
start from a different ref.

Remove that, and let the commits refresh select the current commit
whenever it differs from the one at the previous refresh, like it does
for a newly conflicted commit. A refresh that doesn't change it leaves
the selection alone. This way a background fetch doesn't move the
selection back to the current commit after the user navigated away from
it.

Marking the current commit as good or bad while a different commit is
selected now selects the new current commit too.

Skipping the selected commit when it isn't the current one is an
exception. Git often picks a different commit to test after that, but
we keep the skipped commit selected, so that the user can go on
skipping commits near it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:27:58 +01:00
Stefan Haller d181615c31 Make integration tests using commits more robust
Some tests assert that a specific commit subject does or doesn't occur
in the main view; interactive_rebase/outside_rebase_range_select.go is
an example for this, it asserts `t.Views().Main().Content(
DoesNotContain("commit 06"))`. The problem with this kind of assertion
and our test commit naming scheme is that the diff view begins with a
"commit <hash>" line, and when that hash happens to start with "06" the
assertion matched it and failed spuriously. This was usually masked by
our MaxAttempts=2 that we currently use for integration tests (it's
quite unlikely that the commit gets a hash beginning with "06" twice in
a row). However, we want to get to a state where we can set MaxAttempts
to 1, so make this more robust by changing our naming scheme.
2026-07-09 11:56:27 +02:00
Stefan Haller 562a2aaa6b Un-deprecate UserConfig.Git.Log.Order and ShowGraph
And remove them from AppState.
2025-07-09 13:15:03 +02:00
Stefan Haller 55d8e801f1 Use getters for AppState and UserConfig instead of accessing the fields directly
This will allow us to make them private.
2024-08-18 10:24:52 +02:00
Alex March e354a9bb48 Deprecate git.log.showGraph and git.log.order config
Added identical properties to AppState that should eventually have their defaults set.
2024-02-16 13:23:35 +01:00
Stefan Haller b1d05b6371 Change default of git.log.showGraph to 'always'
Most people seem to prefer it to be on.
2024-02-13 14:34:40 +01:00
Stefan Haller e9bbd816de Make bisect/basic.go test more concrete
- check out a non-main branch before we start
- add authors to expected commits so that we can see whether the commits show an
  asterisk
- explicitly check what the top line displays after bisecting has started

This shows that the detached head shows an asterisk, which we don't want. We'll
fix that in the next commit.
2023-07-31 08:34:01 +02:00
Stefan Haller 6794149ec8 When bisecting, always mark the current commit as good/bad, not the selected
For marking as good or bad, the current commit is pretty much always the one you
want to mark, not the selected. It's different for skipping; sometimes you know
already that a certain commit doesn't compile, for example, so you might
navigate there and mark it as skipped. So in the case that the current commit is
not the selected one, we now offer two separate menu entries for skipping, one
for the current commit and one for the selected.
2023-07-29 14:44:00 +02:00
Stefan Haller f30e09856c Add bisect menu entry that lets you choose bisect terms
This can be useful if you want to find the commit that fixed a bug (you'd use
"broken/fixed" instead of "good/bad" in this case), or if you want to find the
commit that brought a big performance improvement (use "slow/fast"). It's pretty
mind-bending to have to use "good/bad" in these cases, and swap their meanings
in your head.

Thankfully, lazygit already had support for using custom terms during the bisect
(for the case that a bisect was started on the command-line, I suppose), so all
that's needed is adding a way to specify them in lazygit.
2023-07-29 11:59:58 +02: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 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
Jesse Duffield f7e8b2dd71 cleanup integration test code 2023-02-26 12:54:13 +11:00
Jesse Duffield 9fef4447b6 move popup assertions into a struct 2022-12-28 11:00:22 +11:00
Jesse Duffield ed93e0a2b0 remove dependency on model 2022-12-27 22:52:20 +11:00
Jesse Duffield c5050ecabd move shell into test driver 2022-12-27 21:47:37 +11:00
Jesse Duffield 78b495f50a rename input to t 2022-12-27 21:35:36 +11:00
Jesse Duffield 53e06b71ae add tap function 2022-12-27 21:26:18 +11:00
Jesse Duffield b166b8f776 combine assert and input structs, clean up interface 2022-12-27 21:26:18 +11:00
Jesse Duffield 09e80e5f2a better namespacing for assertions 2022-12-27 21:26:18 +11:00
Jesse Duffield be30cbb375 add view asserter getter struct 2022-12-27 21:26:18 +11:00
Jesse Duffield 926ed7b9b2 more refactoring of popup stuff 2022-12-27 21:26:18 +11:00
Jesse Duffield 09db4c4397 allow checking if line is selected in Lines and TopLines methods 2022-12-26 17:45:10 +11:00
Jesse Duffield 96310288ee allow chaining matchers 2022-12-26 17:15:33 +11:00
Jesse Duffield c841ba8237 add switch-to-view methods 2022-12-26 16:49:54 +11:00
Jesse Duffield 9a6f21ce42 cleaner test assertions 2022-12-26 12:20:13 +11:00
Jesse Duffield fa0414777f rename SelectedLine to CurrentLine in tests 2022-12-26 10:42:19 +11:00
Jesse Duffield 5d2584a188 introduce ViewLines functions 2022-12-25 11:38:00 +11:00
Jesse Duffield b623ecf898 add helper functions for popups in tests 2022-12-24 19:15:59 +11:00
Jesse Duffield aedfce2845 refactor to not have Match at the start of assert method names, because it reads better that way 2022-12-24 19:14:52 +11:00
Jesse Duffield 8cdfc6758f add another bisect integration test 2022-09-09 20:55:47 -07:00
Jesse Duffield 010f430d1f add bisect integration test 2022-09-09 20:55:47 -07:00