Have "Find base commit for fixup" ignore fixup commits for the found base commit#5210
Have "Find base commit for fixup" ignore fixup commits for the found base commit#5210stefanhaller merged 5 commits intomasterfrom
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
|
I obviously think this is a great addition to lazygit! 👍 Feels like it is missing tests for the One of the reasons I left the fixups for another commit only as a warning was, that in that case the other fixup commit is probably wrong and has to be changed (after creating the fixup for the current changeset). Most likely the other fixup is either accidentally for the wrong commit or I created it manually and made a typo. That's why I thought it was reasonable to just plainly ignore all other fixup commits in #5210 or only show a warning when they are found. But this change will already be a huge improvement, even if it doesn't handle other (possibly wrong) fixup commits. |
They are here and below, I wonder what you think is missing there? I don't have these as separate integration tests if that's what you meant, but that's intentional.
That's ridiculous. This is of course one possibility, but it's an unlikely one, and I'm not going to base the functionality of the command on the assumption that the existing fixups are wrong. Finding several fixups for unrelated base commits is a very common case, and it always means that your changes need to be separated into individual fixups for these, so erroring out is the appropriate behavior. |
Yea, I missed an integration test. But you are right, with those unit tests that should be well covered.
Ah. You are right. I was thinking about an individual hunk, where this is more unlikely and also had the misconception, that it would find the other base commit as a candidate as well. But the search for the base commit is not "deep", so it stops at the first fixup and will not always also find the other base commit as a fixup candidate. |
Currently we get an annoying error message, but we'd like the base commit to be selected, disregarding the fixup.
There's no reason for this to be a method.
aea18be to
268d193
Compare
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.58.1` → `v0.59.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary> ### [`v0.59.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.59.0) [Compare Source](jesseduffield/lazygit@v0.58.1...v0.59.0) <!-- Release notes generated using configuration in .github/release.yml at v0.59.0 --> #### What's Changed ##### Enhancements 🔥 - Have "Find base commit for fixup" ignore fixup commits for the found base commit by [@​stefanhaller](https://github.com/stefanhaller) in [#​5210](jesseduffield/lazygit#5210) - Exclude commit trailers from line wrapping by [@​stefanhaller](https://github.com/stefanhaller) in [#​5230](jesseduffield/lazygit#5230) - Limit popup panel widths to a maximum width by [@​stefanhaller](https://github.com/stefanhaller) in [#​5231](jesseduffield/lazygit#5231) - Support using the selected commit's message in a fixup by [@​jesseduffield](https://github.com/jesseduffield) in [#​5233](jesseduffield/lazygit#5233) - Fix gitignore path collisions by [@​DawidPietrykowski](https://github.com/DawidPietrykowski) in [#​5245](jesseduffield/lazygit#5245) ##### Fixes 🔧 - Don't log the "git rev-list" call when marking bisect commits by [@​stefanhaller](https://github.com/stefanhaller) in [#​5236](jesseduffield/lazygit#5236) - Fix opening a menu when a previous menu was scrolled down by [@​stefanhaller](https://github.com/stefanhaller) in [#​5238](jesseduffield/lazygit#5238) - When moving commits up/down and the selection leaves the view, scroll to make it visible again by [@​stefanhaller](https://github.com/stefanhaller) in [#​5247](jesseduffield/lazygit#5247) - Fix rendering of CRLF sequence ('\r\n') by [@​stefanhaller](https://github.com/stefanhaller) in [#​5237](jesseduffield/lazygit#5237) - Fix rendering of the Reflog panel when using up/down to scroll it by [@​stefanhaller](https://github.com/stefanhaller) in [#​5248](jesseduffield/lazygit#5248) - Add Nushell support for nvim-remote preset by [@​baiyeidk](https://github.com/baiyeidk) in [#​5250](jesseduffield/lazygit#5250) ##### Maintenance ⚙️ - Update devcontainer `VARIANT` to `1-trixie` by [@​mricherzhagen](https://github.com/mricherzhagen) in [#​5204](jesseduffield/lazygit#5204) - chore: Update outdated GitHub Actions versions by [@​pgoslatara](https://github.com/pgoslatara) in [#​5220](jesseduffield/lazygit#5220) - Disable the automatic, scheduled release by [@​stefanhaller](https://github.com/stefanhaller) in [#​5272](jesseduffield/lazygit#5272) - Auto-update cheatsheets after updating translation by [@​stefanhaller](https://github.com/stefanhaller) in [#​5275](jesseduffield/lazygit#5275) ##### Docs 📖 - Update README to add GitArbor TUI as an alternative by [@​cadamsdev](https://github.com/cadamsdev) in [#​5257](jesseduffield/lazygit#5257) - Update docs and schema for release by [@​stefanhaller](https://github.com/stefanhaller) in [#​5276](jesseduffield/lazygit#5276) ##### I18n 🌎 - Update translations from Crowdin by [@​stefanhaller](https://github.com/stefanhaller) in [#​5274](jesseduffield/lazygit#5274) #### New Contributors - [@​pgoslatara](https://github.com/pgoslatara) made their first contribution in [#​5220](jesseduffield/lazygit#5220) - [@​cadamsdev](https://github.com/cadamsdev) made their first contribution in [#​5257](jesseduffield/lazygit#5257) - [@​baiyeidk](https://github.com/baiyeidk) made their first contribution in [#​5250](jesseduffield/lazygit#5250) **Full Changelog**: <jesseduffield/lazygit@v0.58.1...v0.59.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Ni4yIiwidXBkYXRlZEluVmVyIjoiNDIuOTYuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
If the ctrl-f function (Find base commit for fixup) finds a base commit plus a bunch of fixup! commits for that base commit, it ignores those fixups and selects the base commit. For the purpose of creating another fixup commit on top this is always what you want, so I'm doing this without adding a confirmation. If the user presses shift-A after that to amend their changes though, they are guaranteed to get conflicts, so for that case a warning might be useful; however, I find it unlikely that users will want to amend changes to a commit that they already created fixups for, so I'm just hoping that this won't happen in practice.
This implementation is a bit stricter than #5201, in that it only ignores fixups if the first found commit is not a fixup itself; because if it is, it's not clear whether the user wants to create another fixup for both on top, or amend the changes into each one, in which case they need to be staged individually.