diff options
author | Tom Mewett <tom.mewett@codethink.co.uk> | 2020-01-09 14:00:04 +0000 |
---|---|---|
committer | Tom Mewett <tom.mewett@codethink.co.uk> | 2020-01-14 10:54:17 +0000 |
commit | c3f1a1f0c6eab12491634a78b9209e5aa0d79155 (patch) | |
tree | 715273c99a56e66aca43cbb36a4c5876f17903a3 | |
parent | 4b63d159905313edb76946d998bdda04605237f6 (diff) | |
download | buildstream-c3f1a1f0c6eab12491634a78b9209e5aa0d79155.tar.gz |
repo/git.py: Add optional date argument to add_commit
-rw-r--r-- | tests/testutils/repo/git.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py index 1deca3ff7..779eb76e9 100644 --- a/tests/testutils/repo/git.py +++ b/tests/testutils/repo/git.py @@ -42,8 +42,11 @@ class Git(Repo): def add_annotated_tag(self, tag, message): self._run_git("tag", "-a", tag, "-m", message) - def add_commit(self): - self._run_git("commit", "--allow-empty", "-m", "Additional commit") + def add_commit(self, date=None): + env = self.env + if date is not None: + env["GIT_AUTHOR_DATE"] = env["GIT_COMMITTER_DATE"] = str(date) + self._run_git("commit", "--allow-empty", "-m", "Additional commit", env=env) return self.latest_commit() def add_file(self, filename): |