wfxr / forgit

:zzz: A utility tool powered by fzf for using git interactively.
MIT License
4.33k stars 136 forks source link

Fix function call in standalone forgit #239

Closed carlfriedrich closed 1 year ago

carlfriedrich commented 1 year ago

From the standalone forgit command we call the according forgit function by replacing a _ with ::. Since we have more complex function names like forgit::cherry::pick::from::branch we have to replace ALL instances of _ instead of just the first one.

Check list

Description

Type of change

Test environment

carlfriedrich commented 1 year ago

And another fix for git-forgit. @wren I am quite sure that this is an undeliberate bug, can you please confirm?

wren commented 1 year ago

@carlfriedrich The current code replaces the first underscore with :: to match the function names. This doesn't count forgit::, though (since that's hardcoded). So, forgit::stash:show and forgit::reset::head should both already work (I have ss = forgit stash_show as an alias in my own config).

When git-forgit was merged, there weren't any functions that had more than that many colons, so it covered all the use cases at the time (but was admittedly not very future-proof).

The only function I see now that has more colons is forgit::cherry::pick::from::branch (which looks to have been merged afterward). So, this fix should work to update git-forgit to work with newer functions like forgit::cherry::pick::from::branch.

Good find!

carlfriedrich commented 1 year ago

The only function I see now that has more colons is forgit::cherry::pick::from::branch (which looks to have been merged afterward). So, this fix should work to update git-forgit to work with newer functions like forgit::cherry::pick::from::branch.

@wren You're totally right. I actually even noticed the error on forgit::cherry::pick::from::branch, but then I just chose different functions for the bug report without checking those, forgetting about the hard-coded forgit:: extraction.

Thanks for your quick reply!