Skip to content

Conversation

@EliasA5
Copy link
Contributor

@EliasA5 EliasA5 commented May 28, 2025

  • PR Description

When pressing N to move new commits to a new branch we get greeted with an empty prompt, this PR makes it so we fill the empty prompt with a suggestion taken from branchPrefix, similar to the good old create a new branch.

  • 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

@EliasA5
Copy link
Contributor Author

EliasA5 commented May 28, 2025

im not sure to add an entirely new unit-test or extend new_branch_with_prefix/move_commits_to_new_branch_from_base_branch tests

@EliasA5
Copy link
Contributor Author

EliasA5 commented May 28, 2025

Closes #4605

@stefanhaller stefanhaller added the enhancement New feature or request label May 29, 2025
@stefanhaller stefanhaller force-pushed the use-branch-prefix-move-new-commits branch from 75ae674 to c6523e6 Compare May 29, 2025 12:10
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 the PR, very good work. I pushed a bunch of fixups for some style nitpicks, see below.

The one change that I did't push a fixup for is moving the empty-string check to the call site.

As for testing, I'd be fine with including a check in any of the move_commits_to_new_branch_* tests (I'd say one of them is enough).

@EliasA5 EliasA5 force-pushed the use-branch-prefix-move-new-commits branch from 09bf24e to 133a202 Compare May 29, 2025 18:07
Moving the getter of the suggested branch name to a separate function
allows us to reuse it in situations where we are not calling the regular
create new branch function, such as move commits to a new branch

Signed-off-by: Elias Assaf <[email protected]>
@EliasA5 EliasA5 force-pushed the use-branch-prefix-move-new-commits branch from 133a202 to 129e8f7 Compare May 29, 2025 18:08
@EliasA5
Copy link
Contributor Author

EliasA5 commented May 29, 2025

Thanks @stefanhaller for the review and fixes

I changed my mind and made fixups for this, too, since it was so easy

Everything is so easy when using lazygit

I updated the test and squashed all the fixup commits

@stefanhaller
Copy link
Collaborator

Thanks, looks great. One last fixup for the test: cee1120

@stefanhaller stefanhaller force-pushed the use-branch-prefix-move-new-commits branch from cee1120 to fdf9726 Compare May 29, 2025 20:39
@stefanhaller stefanhaller changed the title Use branchPrefix in moving new commits Use branchPrefix when moving commits to new branch May 29, 2025
@stefanhaller stefanhaller enabled auto-merge May 29, 2025 20:40
@stefanhaller stefanhaller merged commit 8280fde into jesseduffield:master May 29, 2025
14 checks passed
@EliasA5 EliasA5 deleted the use-branch-prefix-move-new-commits branch May 29, 2025 20:46
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jun 12, 2025
This MR contains the following updates:

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

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

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

#### What's Changed

##### Enhancements 🔥

-   Add user config for hiding the root item in the file tree by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4593
-   Use branchPrefix when moving commits to new branch by [@&#8203;EliasA5](https://github.com/EliasA5) in jesseduffield/lazygit#4604
-   Show default option when prompting to create a new git repo by [@&#8203;Joshuahuahua](https://github.com/Joshuahuahua) in jesseduffield/lazygit#4596

##### Fixes 🔧

-   Fix selecting large hunks, and fix problems editing very long commit descriptions by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4589
-   Kill background fetch when it requests a passphrase by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4588
-   Fix branch selection jumping back on background fetch by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4597
-   Fix resetting to a branch when a tag shares the same name, or vice versa by [@&#8203;ChrisMcD1](https://github.com/ChrisMcD1) in jesseduffield/lazygit#4571
-   Fix wrong inactive highlight when switching between repos by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4621
-   Fix assigning custom key to pullFiles command in the Commits panel by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4617

##### Maintenance ⚙️

-   Replace literal with ConfigFilename constant by [@&#8203;mloskot](https://github.com/mloskot) in jesseduffield/lazygit#4613
-   Improve MR template wrt release notes by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4607

#### New Contributors

-   [@&#8203;mloskot](https://github.com/mloskot) made their first contribution in jesseduffield/lazygit#4613
-   [@&#8203;Joshuahuahua](https://github.com/Joshuahuahua) made their first contribution in jesseduffield/lazygit#4596

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants