Skip to contentSkip to conversation

oeqa/utils/gitarchive: Handle case where parent is only on origin

PATCH New Richard Purdie 1 participant 1 message Feb 25, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa/utils/gitarchive: Handle case where parent is only on origin

The parent code currently assumed that any parent branch is locally checked out which may not be the case.

Use the local branch by default but fall back to the origin. This also means removing the later saftey check as the branch may not exist locally.

This fixes the autobuilder resulttool test pushing code.

---
 meta/lib/oeqa/utils/gitarchive.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/lib/oeqa/utils/gitarchive.py +2 -2
index ff614d06bbf..9520b2e1261 100644
@@ -80,6 +80,8 @@ def git_commit_data(repo, data_dir, branch, message, exclude, notes, log):
 
         # Create new commit object from the tree
         parent = repo.rev_parse(branch)
+        if not parent:
+            parent = repo.rev_parse("origin/" + branch)
         git_cmd = ['commit-tree', tree, '-m', message]
         if parent:
             git_cmd += ['-p', parent]
@@ -93,8 +95,6 @@ def git_commit_data(repo, data_dir, branch, message, exclude, notes, log):
 
         # Update branch head
         git_cmd = ['update-ref', 'refs/heads/' + branch, commit]
-        if parent:
-            git_cmd.append(parent)
         repo.run_cmd(git_cmd)
 
         # Update current HEAD, if we're on branch 'branch'
Signature · 1 line
2.20.1