summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/wrappers/git.py
diff options
context:
space:
mode:
authorVlad Ionescu <vlad@vladionescu.com>2016-05-25 15:30:31 -0700
committerVlad Ionescu <vlad@vladionescu.com>2016-05-25 15:30:31 -0700
commit2afdae5f9f68de7ff14d7238986e190c1450be12 (patch)
treec877ed3c06b216d52f6c8221a8772a3d79aece34 /gitautodeploy/wrappers/git.py
parent7b79fcf9d1bd577c9fdbd42d419002ef16f1c879 (diff)
downloadGit-Auto-Deploy-2afdae5f9f68de7ff14d7238986e190c1450be12.zip
Git-Auto-Deploy-2afdae5f9f68de7ff14d7238986e190c1450be12.tar.gz
Git-Auto-Deploy-2afdae5f9f68de7ff14d7238986e190c1450be12.tar.bz2
Git wrapper was fixed to call bash.exe first if on Windows. It ...
assumes Git for Windows is installed, which puts bash.exe at \Program Files\Git\usr\bin\bash.exe.
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