mirror of
https://github.com/frappe/bench.git
synced 2025-01-23 23:18:24 +00:00
[fix] shallow clone
This commit is contained in:
parent
6b5e5d2d4d
commit
13b4825fb6
@ -44,7 +44,7 @@ def write_appstxt(apps, bench='.'):
|
|||||||
|
|
||||||
def get_app(app, git_url, branch=None, bench='.', build_asset_files=True, verbose=False):
|
def get_app(app, git_url, branch=None, bench='.', build_asset_files=True, verbose=False):
|
||||||
logger.info('getting app {}'.format(app))
|
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 ''
|
branch = '--branch {branch}'.format(branch=branch) if branch else ''
|
||||||
exec_cmd("git clone {git_url} {branch} {shallow_clone} --origin upstream {app}".format(
|
exec_cmd("git clone {git_url} {branch} {shallow_clone} --origin upstream {app}".format(
|
||||||
git_url=git_url,
|
git_url=git_url,
|
||||||
|
@ -246,12 +246,15 @@ def check_cmd(cmd, cwd='.'):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def get_git_version():
|
def get_git_version():
|
||||||
version = get_cmd_output("git --version")
|
'''returns git version from `git --version`
|
||||||
return version.strip().split()[-1]
|
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():
|
def check_git_for_shallow_clone():
|
||||||
git_version = get_git_version()
|
git_version = get_git_version()
|
||||||
if git_version.startswith('1.9') or git_version.startswith('2'):
|
if git_version > 1.9:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -22,6 +22,13 @@
|
|||||||
creates: "{{ bench_path }}/apps/frappe"
|
creates: "{{ bench_path }}/apps/frappe"
|
||||||
chdir: "{{ bench_path }}"
|
chdir: "{{ bench_path }}"
|
||||||
|
|
||||||
|
# setup procfile
|
||||||
|
- name: setup procfile
|
||||||
|
command: bench setup socketio
|
||||||
|
args:
|
||||||
|
creates: "{{ bench_path }}/node_modules"
|
||||||
|
chdir: "{{ bench_path }}"
|
||||||
|
|
||||||
# setup procfile
|
# setup procfile
|
||||||
- name: setup procfile
|
- name: setup procfile
|
||||||
command: bench setup procfile
|
command: bench setup procfile
|
||||||
|
@ -76,10 +76,10 @@ def clone_bench_repo():
|
|||||||
|
|
||||||
if os.path.exists(bench_repo):
|
if os.path.exists(bench_repo):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
os.makedirs('/usr/local/frappe')
|
os.makedirs('/usr/local/frappe')
|
||||||
success = run_os_command(
|
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
|
return success
|
||||||
|
Loading…
x
Reference in New Issue
Block a user