Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to parse header on simple example #1029

Closed
robambalu opened this issue Jul 10, 2020 · 2 comments
Closed

Failing to parse header on simple example #1029

robambalu opened this issue Jul 10, 2020 · 2 comments

Comments

@robambalu
Copy link

@robambalu robambalu commented Jul 10, 2020

I just installed gitpython and on my very first attempt I'm hitting strange errors.
Simple example, NYC corona virus github:
git clone https://github.com/nychealth/coronavirus-data

in python, create repo:

r = Repo( 'coronavirus-data')

lets get the latest commit date ( poof )

r.head.commit.committed_date
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\robam\AppData\Local\Programs\Python\Python38\lib\site-packages\gitdb\util.py", line 253, in getattr
self.set_cache(attr)
File "C:\Users\robam\AppData\Local\Programs\Python\Python38\lib\site-packages\git\objects\commit.py", line 142, in set_cache
_binsha, _typename, self.size, stream = self.repo.odb.stream(self.binsha)
File "C:\Users\robam\AppData\Local\Programs\Python\Python38\lib\site-packages\git\db.py", line 42, in stream
hexsha, typename, size, stream = self._git.stream_object_data(bin_to_hex(sha))
File "C:\Users\robam\AppData\Local\Programs\Python\Python38\lib\site-packages\git\cmd.py", line 1085, in stream_object_data
hexsha, typename, size = self.__get_object_header(cmd, ref)
File "C:\Users\robam\AppData\Local\Programs\Python\Python38\lib\site-packages\git\cmd.py", line 1057, in __get_object_header
return self._parse_object_header(cmd.stdout.readline())
File "C:\Users\robam\AppData\Local\Programs\Python\Python38\lib\site-packages\git\cmd.py", line 1021, in _parse_object_header
raise ValueError("SHA %s could not be resolved, git returned: %r" % (tokens[0], header_line.strip()))
ValueError: SHA b'10004,Financial' could not be resolved, git returned: b'10004,Financial District,Manhattan,33,903.96,3650.61,1,27.39,6.75,489'

@robambalu
Copy link
Author

@robambalu robambalu commented Jul 12, 2020

FYI this seems to be a problem when running from an interactive shell, running within a script seems to work ok

@Byron
Copy link
Member

@Byron Byron commented Jul 12, 2020

I believe this is a shortcoming when there are multiple handles to objects at the same time. Depending on the order of operations, they may interfere with each other. Due to long-lived objects in an interactive shell, this issue may be more prominent than in scripts, where one more naturally works with one object at a time.

The only way to workaround this is to create a repository with a non-default object database implementation.

In the hopes that this helps, I am closing the issue on the grounds of it being know and that a fix is not possible, but a workaround. Please let me know if you think this is something else, or if the workaround doesn't seem effective.

@Byron Byron closed this Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.