Skip to content

Conversation

@m04f
Copy link
Contributor

@m04f m04f commented Jun 23, 2025

  • PR Description

When GPG signing is enabled but overrideGpg is false, attempting to reword a non-latest commit would show the "Feature not vailable for users using GPG" error only after the user had already entered the commit message.

Now the error is displayed immediately when attempting to start the reword operation, before opening the editor.

Closes #4611

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

Copy link
Collaborator

@stefanhaller stefanhaller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing, the fix looks good, just one small nitpick below.

One more thought: the original if statement is still there now, but will never be true any more. I'm undecided what we should do with this:

  1. keep it there, in case we refactor the code again in the future and forget to check upfront, maybe from a different call site
  2. replace it with a panic (which would be the equivalent of assert in other languages)
  3. remove it altogether

Any thoughts? If we do 1., I suppose we should at least add a comment there.

@stefanhaller stefanhaller added the bug Something isn't working label Jun 29, 2025
@m04f
Copy link
Contributor Author

m04f commented Jun 29, 2025

I had the same thought about the original if statement when writing this. I think keeping it there could be useful in case it becomes reachable again through another call site in the future.

@stefanhaller
Copy link
Collaborator

I think keeping it there could be useful in case it becomes reachable again through another call site in the future.

Works for me, but as I said I think we should add a comment to that effect, so that future readers of the code aren't confused. Something like

	// This will never be true because controllers are supposed to check for it
	// before calling this method. Keeping it here in case we add new call sites
	// in the future that don't do the check.

@stefanhaller
Copy link
Collaborator

Thanks, looks great now.

Two more things to keep in mind for future PRs:

  • please don't just pile up new commits; try to create a sane commit history. Don't assume that all commits will be squashed anyway when merging, we don't do this here. (In this case, just squash the three commits; in the future, a good way to handle this is fixup commits.)
  • please don't create pull requests from your fork's master branch; create a feature branch instead. This makes it less awkward for maintainers to push fixups if necessary, or to rebase your branch.

@stefanhaller stefanhaller enabled auto-merge June 30, 2025 06:38
@stefanhaller stefanhaller merged commit 75ee875 into jesseduffield:master Jun 30, 2025
14 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jul 6, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.52.0` -> `v0.53.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.53.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.53.0)

[Compare Source](jesseduffield/lazygit@v0.52.0...v0.53.0)

<!-- Release notes generated using configuration in .github/release.yml at v0.53.0 -->

This is the first lazygit release after Jesse [passed the maintainership to me](jesseduffield/lazygit#4655) ([@&#8203;stefanhaller](https://github.com/stefanhaller)), and I'm excited (and a little bit nervous 😄) about it.

No big new features this time, but lots of smaller quality-of-life improvements. The one that makes the biggest difference for me is an improved hunk selection mode in the staging view (in case you didn't know, you can switch from the normal line selection mode to hunk mode by pressing `a`). This now works a bit more fine-grained, by selecting groups of added or deleted lines rather than entire hunks, which often consist of several such groups. With this change I find that I prefer hunk mode over line mode in most cases, so I added a user config to switch to hunk automatically upon entering the staging view; it is off by default, but I encourage you to enable it (`gui.useHunkModeInStagingView`) to see if you like it as much as I do. Feedback about this is welcome; please comment on [the MR](jesseduffield/lazygit#4684) if you have any.

The detailed list of all changes follows:

#### What's Changed

##### Enhancements 🔥

- Add option to disable warning when amending last commit by [@&#8203;johnhamlin](https://github.com/johnhamlin) in jesseduffield/lazygit#4640
- Add bold style for border by [@&#8203;aidancz](https://github.com/aidancz) in jesseduffield/lazygit#4644
- Add credential prompts for PKCS11-based SSH keys by [@&#8203;Jadeiin](https://github.com/Jadeiin) in jesseduffield/lazygit#4646
- Show annotation information for selected tag by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4663
- Show stash name for selected stash by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4673
- Auto-stash modified files when cherry-picking or reverting commits by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4683
- Move to next stageable line when adding a line to a custom patch by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4675
- Improve hunk selection mode in staging view by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4684
- Add user config to use hunk mode by default when entering staging view by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4685

##### Fixes 🔧

- Fix stash operations when branch named 'stash' exists by [@&#8203;ChrisMcD1](https://github.com/ChrisMcD1) in jesseduffield/lazygit#4641
- Fix moving a custom patch from the very first commit of the history to a later commit by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4631
- Fix DEFAULT\_REMOTE\_ICON character code by [@&#8203;bedlamzd](https://github.com/bedlamzd) in jesseduffield/lazygit#4653
- Show GPG error before entering commit editor when rewording non-latest commits by [@&#8203;m04f](https://github.com/m04f) in jesseduffield/lazygit#4660
- Fix branch head icon appearing at head commit when a remote or tag exists with the same name as the current branch by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4669
- Fix applying custom patches to a dirty working tree by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4674
- Collapse selection after deleting a range of branches or stashes by [@&#8203;nileric](https://github.com/nileric) in jesseduffield/lazygit#4661

##### Maintenance ⚙️

- Instantiate mutexes by value by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4632
- Bump github.com/cloudflare/circl from 1.6.0 to 1.6.1 by [@&#8203;dependabot](https://github.com/dependabot) in jesseduffield/lazygit#4633
- Update linter by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4671
- Some code cleanups to the "discard file changes from commit" feature by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4679
- Change Refresh to not return an error by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4680

##### Docs 📖

- Fix formatting of a keyboard shortcut in the README.md by [@&#8203;DanOpcode](https://github.com/DanOpcode) in jesseduffield/lazygit#4678

##### I18n 🌎

- Update translations from Crowdin by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4686

#### New Contributors

- [@&#8203;johnhamlin](https://github.com/johnhamlin) made their first contribution in jesseduffield/lazygit#4640
- [@&#8203;aidancz](https://github.com/aidancz) made their first contribution in jesseduffield/lazygit#4644
- [@&#8203;bedlamzd](https://github.com/bedlamzd) made their first contribution in jesseduffield/lazygit#4653
- [@&#8203;Jadeiin](https://github.com/Jadeiin) made their first contribution in jesseduffield/lazygit#4646
- [@&#8203;m04f](https://github.com/m04f) made their first contribution in jesseduffield/lazygit#4660
- [@&#8203;DanOpcode](https://github.com/DanOpcode) made their first contribution in jesseduffield/lazygit#4678
- [@&#8203;nileric](https://github.com/nileric) made their first contribution in jesseduffield/lazygit#4661

**Full Changelog**: jesseduffield/lazygit@v0.52.0...v0.53.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:eyJjcmVhdGVkSW5WZXIiOiI0MC42Mi4xIiwidXBkYXRlZEluVmVyIjoiNDAuNjIuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Feature not available for users using GPG." is shown too late

2 participants