]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
patchtest: fix failure when oe-core repo is in detached HEAD
authorNaftaly RALAMBOARIVONY <naftaly.ralamboarivony@smile.fr>
Thu, 2 Oct 2025 13:10:24 +0000 (15:10 +0200)
committerMathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Mon, 20 Oct 2025 16:25:28 +0000 (18:25 +0200)
commita8fade4ee8aecf755f62eb7c2ec2237cea1d2f7c
tree639bb16e0aeb616ac0c22977668b08c37e9956a5
parente8375c72188b08f34b29b7cf791d94caac73bf66
patchtest: fix failure when oe-core repo is in detached HEAD

Patchtest fails when oe-core git repo is in a "detached HEAD" state:

Error log:

> File "/usr/lib/python3/dist-packages/git/repo/base.py", line 881, in
active_branch return self.head.reference ^^^^^^^^^^^^^^^^^^^

> File "/usr/lib/python3/dist-packages/git/refs/symbolic.py", line 311, in
_get_reference raise TypeError("%s is a detached symbolic reference as it
points to %r" % (self, sha)) TypeError: HEAD is a detached symbolic reference
as it points to '3dd31d3b29730fa1130645d76bb71914ac036335' None

In this case, no current branch is available for the clean operation.

To fix this, updates the checkout logic:
- if a current branch is available, use it,
- otherwise, fall back to the commit pointed to by HEAD.

This ensures that the script works correctly even when HEAD is detached.

Signed-off-by: Naftaly RALAMBOARIVONY <naftaly.ralamboarivony@smile.fr>
Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
meta/lib/patchtest/repo.py