Skip to content

Commit

Permalink
dont show abs path in console output
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarnajjar committed Oct 10, 2022
1 parent 538ba12 commit 35c313e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pautomate/common/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,30 +128,30 @@ def fetch_repo(
url {str} -- repo url in gitlab
summery_info {Dict[str, str]} -- the result of the cloning/fetching
"""
repo_path = join(working_directory, repo_path)
if isdir(repo_path):
abs_repo_path = join(working_directory, repo_path)
if isdir(abs_repo_path):
print_green(f'Fetching {repo_path}')
shell_first(f'git -C {repo_path} fetch --prune')
remote_banches = shell(f'git -C {repo_path} ls-remote --heads')
shell_first(f'git -C {abs_repo_path} fetch --prune')
remote_banches = shell(f'git -C {abs_repo_path} ls-remote --heads')
current_branch = shell_first(
f'git -C {repo_path} rev-parse --abbrev-ref HEAD --',
f'git -C {abs_repo_path} rev-parse --abbrev-ref HEAD --',
)
if f'refs/heads/{current_branch}' in remote_banches:
shell_first(
f'git -C {repo_path} fetch --prune -u '
f'git -C {abs_repo_path} fetch --prune -u '
f'origin {current_branch}:{current_branch}',
)
else:
print_yellow(f'{current_branch} does not exist on remote')

if ('refs/heads/develop' in remote_banches and current_branch != 'develop'): # noqa E501
shell_first(
f'git -C {repo_path} fetch --prune origin develop:develop',
f'git -C {abs_repo_path} fetch --prune origin develop:develop',
)
else:
print_green(f'Cloning {repo_path}')
shell_first(f'git clone {url} {repo_path}')
shell_first(f'git clone {url} {abs_repo_path}')
current_branch = shell_first(
f'git -C {repo_path} rev-parse --abbrev-ref HEAD --',
f'git -C {abs_repo_path} rev-parse --abbrev-ref HEAD --',
)
summery_info.update({repo_path: current_branch})

0 comments on commit 35c313e

Please sign in to comment.