mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +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 = []
|
hashes = []
|
||||||
for commit in commits:
|
for commit in commits:
|
||||||
if commit.reset:
|
if commit.tree:
|
||||||
tree = None
|
if commit.reset:
|
||||||
r = self._session.post('https://api.github.com/repos/{}/git/trees'.format(self.name), json={
|
tree = None
|
||||||
'tree': [
|
r = self._session.post('https://api.github.com/repos/{}/git/trees'.format(self.name), json={
|
||||||
{'path': k, 'mode': '100644', 'type': 'blob', 'content': v}
|
'tree': [
|
||||||
for k, v in commit.tree.items()
|
{'path': k, 'mode': '100644', 'type': 'blob', 'content': v}
|
||||||
],
|
for k, v in commit.tree.items()
|
||||||
'base_tree': tree
|
],
|
||||||
})
|
'base_tree': tree
|
||||||
assert r.ok, r.text
|
})
|
||||||
tree = r.json()['sha']
|
assert r.ok, r.text
|
||||||
|
tree = r.json()['sha']
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'parents': parents,
|
'parents': parents,
|
||||||
|
Loading…
Reference in New Issue
Block a user