Skip to content

Commit

Permalink
Change the rest of the methods to use -C. Still some usage of getcwd …
Browse files Browse the repository at this point in the history
…in test_unit_repository_git.
  • Loading branch information
johnpaulalex committed Feb 26, 2023
1 parent 332b106 commit d9c14bf
Show file tree
Hide file tree
Showing 6 changed files with 219 additions and 248 deletions.
6 changes: 2 additions & 4 deletions manic/externals_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ def git_submodule_status(repo_dir):
"""Run the git submodule status command to obtain submodule hashes.
"""
# This function is here instead of GitRepository to avoid a dependency loop
cwd = os.getcwd()
os.chdir(repo_dir)
cmd = ['git', 'submodule', 'status']
cmd = 'git -C {repo_dir} submodule status'.format(
repo_dir=repo_dir).split()
git_output = execute_subprocess(cmd, output_to_caller=True)
submodules = {}
submods = git_output.split('\n')
Expand All @@ -168,7 +167,6 @@ def git_submodule_status(repo_dir):

submodules[items[1]] = {'hash':items[0], 'status':status, 'tag':tag}

os.chdir(cwd)
return submodules

def parse_submodules_desc_section(section_items, file_path):
Expand Down
Loading

0 comments on commit d9c14bf

Please sign in to comment.