mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[ADD] *: support for empty commits
The Commit test object now allows a tree of `None` (or an empty dict, same diff) in which case it will create an empty commit (a commit which uses the same tree as its parent).
This commit is contained in:
parent
3cdcba2f26
commit
b0995adda0
23
conftest.py
23
conftest.py
@ -650,17 +650,18 @@ class Repo:
|
||||
|
||||
hashes = []
|
||||
for commit in commits:
|
||||
if commit.reset:
|
||||
tree = None
|
||||
r = self._session.post('https://api.github.com/repos/{}/git/trees'.format(self.name), json={
|
||||
'tree': [
|
||||
{'path': k, 'mode': '100644', 'type': 'blob', 'content': v}
|
||||
for k, v in commit.tree.items()
|
||||
],
|
||||
'base_tree': tree
|
||||
})
|
||||
assert r.ok, r.text
|
||||
tree = r.json()['sha']
|
||||
if commit.tree:
|
||||
if commit.reset:
|
||||
tree = None
|
||||
r = self._session.post('https://api.github.com/repos/{}/git/trees'.format(self.name), json={
|
||||
'tree': [
|
||||
{'path': k, 'mode': '100644', 'type': 'blob', 'content': v}
|
||||
for k, v in commit.tree.items()
|
||||
],
|
||||
'base_tree': tree
|
||||
})
|
||||
assert r.ok, r.text
|
||||
tree = r.json()['sha']
|
||||
|
||||
data = {
|
||||
'parents': parents,
|
||||
|
Loading…
Reference in New Issue
Block a user