You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ifGit.isdetached(): # try to find associated refs to avoid detached state
605
-
refs=Git.getrefs(rev)
606
-
forrefinrefs: # re-associate with a local or remote branch (rev is the same)
607
-
branch=re.sub(r'^(.*?)\/(.*?)$', r'\2', ref)
603
+
branch=None
604
+
refs=Git.getrefs(rev)
605
+
forrefinrefs: # re-associate with a local or remote branch (rev is the same)
606
+
m=re.match(r'^(.*?)\/(.*?)$', ref)
607
+
ifm: # matches origin/<branch>
608
+
ifnotos.path.exists(os.path.join('.git', 'refs', 'heads', m.group(2))): # okay only if local branch with that name doesn't exist (git will checkout the origin/<branch> in that case)
609
+
branch=m.group(2)
610
+
else:
611
+
branch=ref# matches local branch
612
+
613
+
ifbranch:
608
614
info("Revision \"%s\" matches a branch \"%s\" reference. Re-associating with branch"% (rev, branch))
0 commit comments