summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/wrappers/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitautodeploy/wrappers/git.py')
-rw-r--r--gitautodeploy/wrappers/git.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/gitautodeploy/wrappers/git.py b/gitautodeploy/wrappers/git.py
index 7d18550..78a469c 100644
--- a/gitautodeploy/wrappers/git.py
+++ b/gitautodeploy/wrappers/git.py
@@ -20,11 +20,20 @@ class GitWrapper():
logger.info('No local repository path configured, no pull will occure')
return 0
- cmd = 'unset GIT_DIR ' + \
- '&& git fetch ' + repo_config['remote'] + \
- '&& git reset --hard ' + repo_config['remote'] + '/' + repo_config['branch'] + ' ' + \
- '&& git submodule init ' + \
- '&& git submodule update'
+ import platform
+
+ if platform.system().lower() == "windows":
+ # This assumes Git for Windows is installed.
+ cmd = ['"\Program Files\Git\usr\\bin\\bash.exe"',
+ ' -c "cd ' + repo_config['path'],
+ ' && unset GIT_DIR ']
+ else:
+ cmd = ['unset GIT_DIR ']
+
+ cmd.append(' && git fetch ' + repo_config['remote'])
+ cmd.append(' && git reset --hard ' + repo_config['remote'] + '/' + repo_config['branch'])
+ cmd.append(' && git submodule init ')
+ cmd.append(' && git submodule update')
# '&& git update-index --refresh ' +\
res = ProcessWrapper().call([cmd], cwd=repo_config['path'], shell=True)
@@ -67,4 +76,4 @@ class GitWrapper():
logger.info('%s commands executed with status; %s' % (str(len(res)), str(res)))
- return res \ No newline at end of file
+ return res