From 66240e1f8d038f419e586499579fc437f309419b Mon Sep 17 00:00:00 2001 From: Richard Case Date: Thu, 4 Mar 2021 23:18:42 +0000 Subject: [PATCH] feat: Keep repos shallow if --reset is specified and shallow_clone is set --- bench/app.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bench/app.py b/bench/app.py index 0367ea9b..76344682 100755 --- a/bench/app.py +++ b/bench/app.py @@ -268,9 +268,15 @@ Here are your choices: continue logger.log('pulling {0}'.format(app)) if reset: - exec_cmd("git fetch --all", cwd=app_dir) - exec_cmd("git reset --hard {remote}/{branch}".format( - remote=remote, branch=get_current_branch(app,bench_path=bench_path)), cwd=app_dir) + reset_cmd = "git reset --hard {remote}/{branch}".format( + remote=remote, branch=get_current_branch(app,bench_path=bench_path)) + 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: exec_cmd("git pull {rebase} {remote} {branch}".format(rebase=rebase, remote=remote, branch=get_current_branch(app, bench_path=bench_path)), cwd=app_dir)