spapas / python-git-info

A simple project to get information from the git repository of your project
https://pypi.org/project/python-git-info/
MIT License
28 stars 8 forks source link

TypeError: cannot unpack non-iterable NoneType object #7

Closed glensc closed 3 years ago

glensc commented 3 years ago
  File "plex_trakt_sync/commands/sync.py", line 212, in sync
    git_version = git_version_info()
  File "plex_trakt_sync/version.py", line 7, in git_version_info
    commit = get_git_info()
  File "/usr/local/lib/python3.9/site-packages/gitinfo/gitinfo.py", line 90, in get_git_info
    return get_git_info_dir(gitdir)
  File "/usr/local/lib/python3.9/site-packages/gitinfo/gitinfo.py", line 69, in get_git_info_dir
    return get_pack_info(idx_file, gi)
  File "/usr/local/lib/python3.9/site-packages/gitinfo/pack_reader.py", line 67, in get_pack_info
    pack_idx, index_tot_objects = get_pack_idx(idx_file, gi['commit'])
TypeError: cannot unpack non-iterable NoneType object

please add catch TypeError and return None!

spapas commented 3 years ago

Hello could you please provide a git repo that throws this error so I can properly debug it ?

glensc commented 3 years ago

@spapas no I can't. it went away after the next commit. and I don't want to, it's my private doings.

you should be able to add a guard based on exception trace to return None rather crashing application with an uncaught exception.

spapas commented 3 years ago

It's all right... I've found out that there are more things missing from this project for exampe it doesn't work if the latest commit is of type OBJ_OFS_DELTA (it only works if it's OBJ_COMMIT). I'll try to research the git internals on how to parse the OBJ_OFS_DELTA and see if this also helps with that.

spapas commented 3 years ago

This error should be fixed now!