Change: rules_git_checkout handling branch names with slashes & Remote HEAD. (#944)

* Add: Test for branch names with slashes & Remote HEAD.

* - Add: Handling for removing remote HEAD.
- Change: Improved handling for branches with slash in their names.
This commit is contained in:
ik1ne
2019-09-03 02:16:40 +09:00
committed by Vladimir Iakovlev
parent 1683f45e94
commit 84c16fb69a
2 changed files with 9 additions and 2 deletions
+4 -2
View File
@@ -18,10 +18,12 @@ def get_branches():
stdout=subprocess.PIPE)
for line in proc.stdout.readlines():
line = line.decode('utf-8')
if '->' in line: # Remote HEAD like b' remotes/origin/HEAD -> origin/master'
continue
if line.startswith('*'):
line = line.split(' ')[1]
if '/' in line:
line = line.split('/')[-1]
if line.strip().startswith('remotes/'):
line = '/'.join(line.split('/')[2:])
yield line.strip()