From d621d12eb4cce56e21a0be78c4e7b950827250c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Sun, 13 Jan 2019 19:52:51 +0100 Subject: Switch to safe branch, if current branch is merged --- updateGit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/updateGit.py b/updateGit.py index 825ef45..de1bbc5 100755 --- a/updateGit.py +++ b/updateGit.py @@ -151,13 +151,14 @@ def updatePath(path): for merged_branch in merged_branches: if merged_branch in SAFEBRANCHES: continue - if merged_branch == cur_branch: - continue get_tracking_status = getGitStdout(path, [ 'for-each-ref', '--format=%(upstream:track,nobracket)', 'refs/heads/%s' % merged_branch ]) + if merged_branch == cur_branch: + print("Checking out safe branch, as current is merged.") + getGitStdout(path, 'checkout ' + safe_branch) if get_tracking_status.strip() == 'gone': print('[%s]' % friendly_path, 'Removing branch by force, upstream is gone.') print('[%s]' % friendly_path, -- cgit v1.2.3