Skip to content

Commit

Permalink
fix: only fetch current branch
Browse files Browse the repository at this point in the history
  • Loading branch information
casesolved-co-uk committed Mar 17, 2021
1 parent 82173c1 commit 895c403
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bench/app.py
Expand Up @@ -237,7 +237,7 @@ def pull_apps(apps=None, bench_path='.', reset=False):
continue
app_dir = get_repo_dir(app, bench_path=bench_path)
if os.path.exists(os.path.join(app_dir, '.git')):
out = subprocess.check_output(["git", "status"], cwd=app_dir)
out = subprocess.check_output('git status', shell=True, cwd=app_dir)
out = out.decode('utf-8')
if not re.search(r'nothing to commit, working (directory|tree) clean', out):
print('''
Expand Down Expand Up @@ -266,12 +266,13 @@ 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
branch = get_current_branch(app, bench_path=bench_path)
logger.log('pulling {0}'.format(app))
if reset:
reset_cmd = "git reset --hard {remote}/{branch}".format(
remote=remote, branch=get_current_branch(app,bench_path=bench_path))
reset_cmd = "git reset --hard {remote}/{branch}".format(remote=remote, branch=branch)
if get_config(bench_path).get('shallow_clone'):
exec_cmd("git fetch --depth=1 --no-tags", cwd=app_dir)
exec_cmd("git fetch --depth=1 --no-tags {remote} {branch}".format(remote=remote, branch=branch),
cwd=app_dir)
exec_cmd(reset_cmd, cwd=app_dir)
exec_cmd("git reflog expire --all", cwd=app_dir)
exec_cmd("git gc --prune=all", cwd=app_dir)
Expand All @@ -280,7 +281,7 @@ def pull_apps(apps=None, bench_path='.', reset=False):
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)
remote=remote, branch=branch), cwd=app_dir)
exec_cmd('find . -name "*.pyc" -delete', cwd=app_dir)


Expand Down

0 comments on commit 895c403

Please sign in to comment.