Skip to content

Commit

Permalink
Merge pull request #26909 from terminalmage/issue26907
Browse files Browse the repository at this point in the history
Don't try to git clone from /tmp on Windows
  • Loading branch information
Mike Place committed Sep 4, 2015
2 parents a33569a + 4cbf648 commit 0fbfea1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions salt/modules/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,20 @@ def clone(cwd,
if not isinstance(name, six.string_types):
name = str(name)
command.append(name)
if not os.path.exists(cwd):
os.makedirs(cwd)
clone_cwd = cwd
else:
command.append(cwd)
# Use '/tmp' instead of $HOME (/root for root user) to work around upstream
# git bug. See the following comment on the Salt bug tracker for more info:
# https://github.com/saltstack/salt/issues/15519#issuecomment-128531310
# Use '/tmp' instead of $HOME (/root for root user) to work around
# upstream git bug. See the following comment on the Salt bug tracker
# for more info:
# https://github.com/saltstack/salt/issues/15519#issuecomment-128531310
# On Windows, just fall back to None (runs git clone command using the
# home directory as the cwd).
clone_cwd = '/tmp' if not salt.utils.is_windows() else None
_git_run(command,
cwd='/tmp' if name is None else cwd,
cwd=clone_cwd,
runas=user,
identity=identity,
ignore_retcode=ignore_retcode)
Expand Down

0 comments on commit 0fbfea1

Please sign in to comment.