2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-17 02:25:16 +00:00

feat: Keep repos shallow if --reset is specified and shallow_clone is set

This commit is contained in:
Richard Case 2021-03-04 23:18:42 +00:00 committed by casesolved-co-uk
parent 8a7a532a45
commit 66240e1f8d

View File

@ -268,9 +268,15 @@ Here are your choices:
continue continue
logger.log('pulling {0}'.format(app)) logger.log('pulling {0}'.format(app))
if reset: if reset:
exec_cmd("git fetch --all", cwd=app_dir) reset_cmd = "git reset --hard {remote}/{branch}".format(
exec_cmd("git reset --hard {remote}/{branch}".format( remote=remote, branch=get_current_branch(app,bench_path=bench_path))
remote=remote, branch=get_current_branch(app,bench_path=bench_path)), cwd=app_dir) if get_config(bench_path).get('shallow_clone'):
exec_cmd("git fetch --depth 1 --no-tags", cwd=app_dir)
exec_cmd(reset_cmd, cwd=app_dir)
exec_cmd("git clean -dfx", cwd=app_dir)
else:
exec_cmd("git fetch --all", cwd=app_dir)
exec_cmd(reset_cmd, cwd=app_dir)
else: else:
exec_cmd("git pull {rebase} {remote} {branch}".format(rebase=rebase, exec_cmd("git pull {rebase} {remote} {branch}".format(rebase=rebase,
remote=remote, branch=get_current_branch(app, bench_path=bench_path)), cwd=app_dir) remote=remote, branch=get_current_branch(app, bench_path=bench_path)), cwd=app_dir)