mirror of
https://abf.rosa.ru/djam/abf-console-client-src.git
synced 2025-02-23 18:02:50 +00:00
Fix parsing of git remote show origin -n
in get_project_name
This commit is contained in:
parent
cdafe55150
commit
0606eb5846
1 changed files with 4 additions and 5 deletions
|
@ -45,11 +45,10 @@ def get_project_name(path=None):
|
|||
e["LC_ALL"] = "C"
|
||||
output, ret_code = execute_command(['git', 'remote', 'show', 'origin', '-n'], cwd=path, env=e)
|
||||
|
||||
for line in output.split('\n'):
|
||||
if line.startswith(' Fetch URL:') and 'abf' in line:
|
||||
project_name = line.split('/')[-1][:-4]
|
||||
owner_name = line.split('/')[-2]
|
||||
return (owner_name, project_name)
|
||||
m = re.compile("^.*Fetch URL:\s+.*abf.*:(.+)/([^/]+)[.]git$",re.MULTILINE).search(output)
|
||||
if m:
|
||||
owner_name, project_name = m.groups()
|
||||
return (owner_name, project_name)
|
||||
return (None, None)
|
||||
except ReturnCodeNotZero:
|
||||
return (None, None)
|
||||
|
|
Loading…
Add table
Reference in a new issue