2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 00:37:51 +00:00

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.
This commit is contained in:
Gavin D'souza 2021-05-10 14:45:46 +05:30
parent 70c9c17f63
commit 4cadf2c719

View File

@ -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: