seachicken / gh-poi

✨ Safely clean up your local branches
https://dev.to/seachicken/safely-clean-up-your-local-branches-9i3
MIT License
643 stars 17 forks source link

Fix regex to match HTTPS as well for getHostname #7

Closed ken-matsui closed 2 years ago

ken-matsui commented 2 years ago

Currently, GitHub has two types of URLs: one is SSH, another is HTTPS. The getHostname function seems not to support HTTPS URL; therefore, gh-poi panics due to no matches in case of using HTTPS URL.

⠋ Fetching pull requests... panic: runtime error: index out of range [1] with length 0

goroutine 1 [running]:
main.getHostname({0x1400017a000, 0x6f})
        /home/runner/work/gh-poi/gh-poi/poi.go:106 +0xc4
main.GetBranches({0x100dc2d18, 0x100ea22f0})
        /home/runner/work/gh-poi/gh-poi/poi.go:67 +0x5c
main.main()
        /home/runner/work/gh-poi/gh-poi/main.go:38 +0x278

This PR brings a new regex that matches also HTTPS. You can check it out on regex101.com.

ken-matsui commented 2 years ago

@seachicken Would you like me to squash commits into one?

seachicken commented 2 years ago

Don't worry about it. I do "Squash and merge". I'll release this fix soon as there are some users who need it. Thank you.