Replace underscores with spaces only if they are in the middle of a word

This will fix a corner case in which a repository name starts or ends
with underscores.  For example, a repository with a name '_' will be
cloned as ' ' (space only) without this fix.
Merge pull request #1592 from roktas/fix-underscore-issue

Replace underscores with spaces only if they are in the middle of a word