docker / gordon

Cli application to manage github pull requests
MIT License
176 stars 33 forks source link

Fix bad handling of repository name #158

Closed jbbarth closed 9 years ago

jbbarth commented 9 years ago

I recently tried to use gordon against a repo ending with "deployment" and it didn't work at all. All requests were ending with messages like Error getting pull requests Not Found. After debugging it through fmt.Println() statements (sorry, golang newbie here) I found that the problem was that all requests were sent against the wrong repo name. Actually, in GetRemoteUrl(), the repository name was returned with the last character missing.

Technical explanation extracted from the commit:

The strings.TrimRight() function actually removes characters contained in the second argument from the first one, resulting in removing needed characters from repositories which name ends with 'g', 'i', or 't' (a dot '.' is impossible by construction). The correction function that removes a subtring at the end of a string is strings.TrimSuffix().

Hope this helps! Thanks for this tool btw ;-)

Edit: a demo if it can help: http://play.golang.org/p/18c0sDNwKF

erikh commented 9 years ago

LGTM!