Skip to content

Commit

Permalink
feat: Keep repos shallow if --reset is specified and shallow_clone is…
Browse files Browse the repository at this point in the history
… set
  • Loading branch information
casesolved-co-uk committed Mar 17, 2021
1 parent 8a7a532 commit 66240e1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bench/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,15 @@ def pull_apps(apps=None, bench_path='.', reset=False):
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)
Expand Down

0 comments on commit 66240e1

Please sign in to comment.