summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-12-06 22:44:45 +0900
committerTristan van Berkom <tristan.vanberkom@codethink.co.uk>2019-08-03 22:18:16 -0400
commita64cce881eeb630ca549efc8e8fb1b50da095e8c (patch)
treec6c3e35033bd9685a32d4ae4f1d5eb6909cabeb8
parentaefab6211d3010bf1d342d2c015e2f7974e1d1b8 (diff)
downloadbuildstream-a64cce881eeb630ca549efc8e8fb1b50da095e8c.tar.gz
tests/testutils/repo/git.py: Adding remove_path() helper
A function for removing paths from a git repo, can also be used to remove submodules.
-rw-r--r--tests/testutils/repo/git.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py
index 99b6bb384..5587baacb 100644
--- a/tests/testutils/repo/git.py
+++ b/tests/testutils/repo/git.py
@@ -64,6 +64,12 @@ class Git(Repo):
subprocess.call(['git', 'commit', '-m', 'Added the submodule'], env=GIT_ENV, cwd=self.repo)
return self.latest_commit()
+ # This can also be used to a file or a submodule
+ def remove_path(self, path):
+ subprocess.call(['git', 'rm', path], env=GIT_ENV, cwd=self.repo)
+ subprocess.call(['git', 'commit', '-m', 'Removing {}'.format(path)], env=GIT_ENV, cwd=self.repo)
+ return self.latest_commit()
+
def source_config(self, ref=None, checkout_submodules=None):
config = {
'kind': 'git',