seachicken / gh-poi

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

Fix/comma containg branch name #71

Closed AsPulse closed 2 years ago

AsPulse commented 2 years ago

close #70

In getting branch, here: https://github.com/seachicken/gh-poi/blob/b9f2295afad1e175d8cb5fffa20d1d17f083f94f/conn/command.go#L54-L60 The data was obtained in comma-separated format, as in the following: HEAD,refName,objectName

However, when obtaining the refNames, it was assumed to be "the second element of split by a comma", so the error occured with comma-contained branch name.

Therefore, I have modified it to use the comma-joined string of "excluding the first and last elements" as the refName. ( f373c6e4573423be4ec42bd240937fe96935c248 )

In addition,

head := false
if headValue == "*" {
  head = true
}

I found this writing style a bit redundant,

head := headValue == "*"

I have made this modification. ( 9965e37c74868a5536c55969a9822bb24c4c87da )

I am beginner of Go, so apologies if there are any problems.

codecov[bot] commented 2 years ago

Codecov Report

Merging #71 (1fc15ce) into main (b9f2295) will decrease coverage by 0.03%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
- Coverage   88.21%   88.17%   -0.04%     
==========================================
  Files           3        3              
  Lines         594      592       -2     
==========================================
- Hits          524      522       -2     
  Misses         54       54              
  Partials       16       16              
Impacted Files Coverage Δ
poi.go 90.70% <100.00%> (-0.05%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

AsPulse commented 2 years ago

I removed the headValue, refNameValue variables! Certainly, since there is no need to bother with them if we can retrieve the correct order in an array...

As for how to put a space in the command, I thought it would be better to choose this simpler method, since a colon would suffice! But it was a learning experience, so thank you!

AsPulse commented 2 years ago

Like headValues, refNameValues, I wonder if there is no problem to put the head variable in the initialization of the structure...? I thought so, so I modified it. ( 1fc15ce144543b99c0a1e991f52b7e6767bdb56f )

seachicken commented 2 years ago

Yes, I think it's simple and good 😃

AsPulse commented 2 years ago

Thank you for merging this! :)

seachicken commented 2 years ago

Thank you! I released it now https://github.com/seachicken/gh-poi/releases/tag/v0.6.1