Skip to content

Commit

Permalink
TST: Be explicit with submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Jan 1, 2023
1 parent a0e1635 commit 7590857
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions asv/plugins/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ def pull(self):
def checkout(self, path, commit_hash):
def checkout_existing(display_error):
# Deinit fails if no submodules, so ignore its failure
self._run_git(['submodule', 'deinit', '-f', '.'],
self._run_git(['-c','protocol.file.allow=always', 'submodule', 'deinit', '-f', '.'],
cwd=path, display_error=False, valid_return_codes=None)
self._run_git(['checkout', '-f', commit_hash],
cwd=path, display_error=display_error)
self._run_git(['clean', '-fdx'],
cwd=path, display_error=display_error)
self._run_git(['submodule', 'update', '--init', '--recursive'],
self._run_git(['-c','protocol.file.allow=always', 'submodule', 'update', '--init', '--recursive'],
cwd=path, display_error=display_error)

if os.path.isdir(path):
Expand Down
6 changes: 3 additions & 3 deletions test/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ def test_git_submodule(tmpdir):
commit_hash_0 = dvcs.get_hash("master")

# State 1 (one submodule)
dvcs.run_git(['submodule', 'add', sub_dvcs.path, 'sub1'])
dvcs.run_git(['-c','protocol.file.allow=always', 'submodule', 'add', sub_dvcs.path, 'sub1'])
dvcs.commit('Add sub1')
commit_hash_1 = dvcs.get_hash("master")

# State 2 (one submodule with sub-submodule)
dvcs.run_git(['submodule', 'update', '--init'])
dvcs.run_git(['-c','protocol.file.allow=always', 'submodule', 'update', '--init'])
sub1_dvcs = tools.Git(join(dvcs.path, 'sub1'))
sub_dvcs.run_git(['submodule', 'add', ssub_dvcs.path, 'ssub1'])
sub_dvcs.run_git(['-c','protocol.file.allow=always', 'submodule', 'add', ssub_dvcs.path, 'ssub1'])
sub_dvcs.commit('Add sub1')
sub1_dvcs.run_git(['pull'])
dvcs.run_git(['add', 'sub1'])
Expand Down

0 comments on commit 7590857

Please sign in to comment.