2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-11 15:51:03 +00:00

[fix] shallow clone

This commit is contained in:
Rushabh Mehta 2016-03-16 13:03:09 +05:30
parent 6b5e5d2d4d
commit 13b4825fb6
4 changed files with 16 additions and 6 deletions

View File

@ -44,7 +44,7 @@ def write_appstxt(apps, bench='.'):
def get_app(app, git_url, branch=None, bench='.', build_asset_files=True, verbose=False):
logger.info('getting app {}'.format(app))
shallow_clone = '--depth 1' if check_git_for_shallow_clone() and get_config(bench).get('shallow_clone') else ''
shallow_clone = '--depth 1' if check_git_for_shallow_clone() else ''
branch = '--branch {branch}'.format(branch=branch) if branch else ''
exec_cmd("git clone {git_url} {branch} {shallow_clone} --origin upstream {app}".format(
git_url=git_url,

View File

@ -246,12 +246,15 @@ def check_cmd(cmd, cwd='.'):
return False
def get_git_version():
version = get_cmd_output("git --version")
return version.strip().split()[-1]
'''returns git version from `git --version`
extracts version number from string `get version 1.9.1` etc'''
version = get_cmd_output("git --version").strip().split()[2]
version = '.'.join(version.split('.')[0:2])
return float(version)
def check_git_for_shallow_clone():
git_version = get_git_version()
if git_version.startswith('1.9') or git_version.startswith('2'):
if git_version > 1.9:
return True
return False

View File

@ -22,6 +22,13 @@
creates: "{{ bench_path }}/apps/frappe"
chdir: "{{ bench_path }}"
# setup procfile
- name: setup procfile
command: bench setup socketio
args:
creates: "{{ bench_path }}/node_modules"
chdir: "{{ bench_path }}"
# setup procfile
- name: setup procfile
command: bench setup procfile

View File

@ -76,10 +76,10 @@ def clone_bench_repo():
if os.path.exists(bench_repo):
return 0
os.makedirs('/usr/local/frappe')
success = run_os_command(
{"git": "git clone https://github.com/frappe/bench {bench_repo} --branch new-install".format(bench_repo=bench_repo)}
{"git": "git clone https://github.com/frappe/bench {bench_repo} --depth 1 --branch new-install".format(bench_repo=bench_repo)}
)
return success