You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The script build_related_scripts/get_modified_packs.py doesn't support detached HEAD states in the Git repository. Easily reproduced by doing
git checkout -d <SHA hash of some commit>
python build_relates_scripts/get_modified_packs.py
You'll see something like this error message:
Traceback (most recent call last):
File "/path/to/repo/build_related_scripts/get_modified_packs.py", line 75, in <module>
main()
File "/path/to/repo/build_related_scripts/get_modified_packs.py", line 66, in main
changed_files = get_changed_files(repo_path, prev_ver)
File "/path/to/repo/build_related_scripts/get_modified_packs.py", line 47, in get_changed_files
if str(repo.active_branch) == prev_ver:
File "/path/to/repo/venv/lib/python3.10/site-packages/git/repo/base.py", line 897, in active_branch
return self.head.reference
File "/path/to/repo/venv/lib/python3.10/site-packages/git/refs/symbolic.py", line 357, 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 '38f6f91734837fe79b80ecef68c96678daa67bef'
Tried to wrap the offending if-clause with a try/except, and it works for me. Unsure if it's the best way to fix the problem
try:
if str(repo.active_branch) == prev_ver:
# Get the latest commit in master, prior the merge.
commits_list = list(repo.iter_commits())
prev_ver = str(commits_list[1])
except TypeError:
pass
The text was updated successfully, but these errors were encountered:
Hi @tlium I have now added a patch to the get_modified_packs.py file that should solve your issue, I would appreciate it if you could check and confirm that it is indeed solved
The script build_related_scripts/get_modified_packs.py doesn't support detached HEAD states in the Git repository. Easily reproduced by doing
You'll see something like this error message:
Tried to wrap the offending if-clause with a try/except, and it works for me. Unsure if it's the best way to fix the problem
The text was updated successfully, but these errors were encountered: