From 4cadf2c719f5ecf2580c28b4b2e687d7d8a69e6b Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Mon, 10 May 2021 14:45:46 +0530 Subject: [PATCH] fix: Unshallow clone if update without --reset 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. --- bench/app.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bench/app.py b/bench/app.py index 872270ac..9970655e 100755 --- a/bench/app.py +++ b/bench/app.py @@ -272,6 +272,14 @@ Here are your choices: 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: