You can clone with
HTTPS or Subversion.
We have lots of manual code in utils.path.get_home_dir(), but most of it is either duplicate or inferior to os.path.expanduser('~').
I don't know about the failure cases of the builtin func, but ours is easily broken with:
$> unset HOME
Traceback (most recent call last):
IPython.utils.path.HomeDirError: Undefined $HOME, IPython cannot proceed.
os.path.expanduser(), on the other hand, still works in this case because it falls back on the password db if HOME is unset, rather than falling back on HOME in a subprocess, which is also removed by the above unset. It also probably makes a better choice on Windows, about which we have had issues.