From dccff1f2bcf6e7b8e42fa7bea63b8532ad29b43a Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Sat, 10 Oct 2020 10:45:34 -0400 Subject: msubprojects: Handle wrap-file to wrap-git case --- run_unittests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'run_unittests.py') diff --git a/run_unittests.py b/run_unittests.py index 881b781..1601730 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -9151,6 +9151,20 @@ class SubprojectsCommandTests(BasePlatformTests): self.assertEqual(self._git_local_branch(subp_name), '') self.assertEqual(self._git_local_commit(subp_name), new_commit) + # Create a local project not in a git repository, then update it with + # a git wrap. Without --reset it should print error message and return + # failure. With --reset it should delete existing project and clone the + # new project. + subp_name = 'sub2' + self._create_project(self.subprojects_dir / subp_name) + self._git_create_remote_repo(subp_name) + self._wrap_create_git(subp_name) + with self.assertRaises(subprocess.CalledProcessError) as cm: + self._subprojects_cmd(['update']) + self.assertIn('Not a git repository', cm.exception.output) + self._subprojects_cmd(['update', '--reset']) + self.assertEqual(self._git_local_commit(subp_name), self._git_remote_commit(subp_name)) + @skipIfNoExecutable('true') def test_foreach(self): self._create_project(self.subprojects_dir / 'sub_file') -- cgit v1.1