Ensure directory exists before changing in popen

王权利请求将github/fork/dalehamel/master合并到master

Created by: dalehamel

If the directory does not exist, we want to ensure that it does.

Forking repos will fail in some situations because of this issue.

Fixes the exact problems described in https://github.com/gitlabhq/gitlabhq/issues/4016 for me.

合并请求报告