If running in an msys shell, use the /home/embray environment variable set in that shell to find the user's home.  The surest way to determine this is if the MSYSTEM environment variable is set (it doesn't matter what it's set to).  Obviously this isn't foolproof but there are few better alternatives (one might be to try calling 'uname').
Merge pull request #1897 from embray/msys-home

Better support for $HOME in msys shells on Windows