Interactively select branch in gcp
Check list
- [x] I have performed a self-review of my code
- [x] I have commented my code in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
Description
When we want to perform a cherry pick, we had to pass the target branch as an argument to gcp. Forgit, however, aims to make git selections interactive where possible. Hence it seems natural to select the target branch interactively as well.
This change implements a new function forgit::cherry::pick::from::branch which opens an interactive branch selector and then calls the existing forgit::cherry::pick on the selected branch. Since this seems a far more intuitive way of performing a cherry pick I re-assigned the gcp alias to the new function.
The original forgit::cherry::pick had to be modified slightly in order to get a useful return code from it. Functionality stayed the same, though.
Along with this change I added a new global variable forgit_log_preview_options to reduce code duplication.
@wfxr @cjappl If this works for you and you approve this change I might re-implement #219 in the same manner. That would make me happy. 😄
Type of change
- [ ] Bug fix
- [x] New feature
- [ ] Refactor
- [ ] Breaking change
- [ ] Documentation change
Test environment
- Shell
- [x] bash
- [x] zsh
- [x] fish
- OS
- [x] Linux
- [ ] Mac OS X
- [ ] Windows
- [ ] Others:
I just realized that cherry picking multiple commits probably won't work anymore with my change. Will check and fix that later.
@wfxr @cjappl Hmmm, I fixed my issue with multiple commits, but shellcheck is not happy. It wants me to wrap my commits variable in double quotes to prevent word splitting. Word splitting is what I need here, though. What can we do now?
I tried using an array as well, gives another error: https://github.com/wfxr/forgit/runs/7706380924?check_suite_focus=true
Nevermind, following SC2086, SC2207 and SC2031 I found a way to make the linter happy while the code still works. 😄 Tested in bash and zsh.
Hey @wfxr, is there a chance that you could review this in the near future?
@carlfriedrich 🙏 Sorry for the very late reply.
I just tested it and it works smoothly. Thanks for your contribution!
@carlfriedrich Considering that you have made many great improvements to the project, would you like to be a co-maintainer of this project?
@wfxr Great, thanks for merging! And yes, thanks a lot for the invitation! :-)
Woo hoo! Congrats bud :) welcome to the team. 🎉
On Tue, Sep 13, 2022 at 2:20 AM, Tim @.***> wrote:
@.***(https://github.com/wfxr) Great, thanks for merging! And yes, thanks a lot for the invitation! :-)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>