diff options
author | Benoit Pierre <benoit.pierre@gmail.com> | 2023-03-04 21:28:46 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2023-03-04 20:35:30 -0500 |
commit | 8da060706c2c34fbea91898509123cb190894f3e (patch) | |
tree | ca722f2dacdd7e041791ef7d568866c4bf6403df /unittests | |
parent | 93c11f249495c4af4a88206cebefef3ecf0f3228 (diff) | |
download | meson-8da060706c2c34fbea91898509123cb190894f3e.zip meson-8da060706c2c34fbea91898509123cb190894f3e.tar.gz meson-8da060706c2c34fbea91898509123cb190894f3e.tar.bz2 |
msubprojects: fix potential error when resetting a git checkout
Untracked files need to be stashed too, or resetting may fail when
trying to (re-)apply a patch that adds one of those untracked files.
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/subprojectscommandtests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/subprojectscommandtests.py b/unittests/subprojectscommandtests.py index bca124d..d50828b 100644 --- a/unittests/subprojectscommandtests.py +++ b/unittests/subprojectscommandtests.py @@ -177,6 +177,17 @@ class SubprojectsCommandTests(BasePlatformTests): self.assertEqual(self._git_local_commit(subp_name), self._git_remote_commit(subp_name, 'newbranch')) self.assertTrue(self._git_local(['stash', 'list'], subp_name)) + # Untracked files need to be stashed too, or (re-)applying a patch + # creating one of those untracked files will fail. + untracked = self.subprojects_dir / subp_name / 'untracked.c' + untracked.write_bytes(b'int main(void) { return 0; }') + self._subprojects_cmd(['update', '--reset']) + self.assertTrue(self._git_local(['stash', 'list'], subp_name)) + assert not untracked.exists() + # Ensure it was indeed stashed, and we can get it back. + self.assertTrue(self._git_local(['stash', 'pop'], subp_name)) + assert untracked.exists() + # Create a new remote tag and update the wrap file. Checks that # "meson subprojects update --reset" checkout the new tag in detached mode. self._git_create_remote_tag(subp_name, 'newtag') |