Skip to content

Commit

Permalink
fix: Unshallow clone if update without --reset
Browse files Browse the repository at this point in the history
If an unshallow clone has to be updated, the only way to update it
without a reset will require an unshallow. This is because there may be
uncommitted or committed changes in any of the apps, although unfavoured
should be handled safely. The only way to update such repos is via the
user configured settings..or a ff only merge.
  • Loading branch information
gavindsouza committed May 10, 2021
1 parent 70c9c17 commit 4cadf2c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bench/app.py
Expand Up @@ -272,6 +272,14 @@ def pull_apps(apps=None, bench_path='.', reset=False):
add_to_excluded_apps_txt(app, bench_path=bench_path)
print("Skipping pull for app {}, since remote doesn't exist, and adding it to excluded apps".format(app))
continue

if not get_config(bench_path).get('shallow_clone') or not reset:
is_shallow = os.path.exists(os.path.join(app_dir, ".git", "shallow"))
if is_shallow:
s = " to safely pull remote changes." if not reset else ""
print(f"Unshallowing {app}{s}")
exec_cmd(f"git fetch {remote} --unshallow", cwd=app_dir)

branch = get_current_branch(app, bench_path=bench_path)
logger.log('pulling {0}'.format(app))
if reset:
Expand Down

0 comments on commit 4cadf2c

Please sign in to comment.