-
-
Notifications
You must be signed in to change notification settings - Fork 934
"Attribute 'path' unset" when accessing the blobs/trees in a tree object returned by git.repo.fun.name_to_object #759
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
Comments
version: 2.1.8-1/python3.6 |
Thanks for letting us know!
|
It does not work with rev_parse either. It raises the same exception. As a workaround, I simply set a fake path on the object like this:
This has no effect on the result. The actual code is like this: https://github.com/ali1234/gitxref/blob/8bced542d6d60493d9fdd5a8e4b27402c79741eb/gitxref/backrefs.py#L96 |
If it's not clear from the above code, what I am trying to do is iterate over every commit and tree in the repo and for each, return a list of binsha of subtrees, and for trees, also a list of binsha of blobs. The order does not matter and the paths do not matter. Speed is very important - this operation takes 15 minutes on a kernel tree when using 8 processes. Perhaps there is a way to do this without having to look up each hexsha? Maybe by using gitdb directly? |
I see, so it does appear this bug is inherent all of GitPython, unless of course the code-path GitPython takes right after calling For the fastest possible access, you could try using a |
My version of GitPython appears to use GitCmdObjectDB by default. In fact my program does not work correctly if I tell it to use GitDB - it crashes with "unexpected delta opcode 0", possibly related to the other bug I reported. |
It looks like by now GitPython is falling apart :D!
The `GitDb` implementation is written in pure-python, but wasn't adjusted
in a long time. Probably by now it simply doesn't understand modern
repositories anymore. Another reason for the `GitCmdObjectDB` being the
default for some time now.
Besides that, I wouldn't know how to make the aforementioned process
faster, except for maybe writing the hot portions in Rust (with
https://docs.rs/git2/0.7.1/git2/) or using the respective python bindings.
…On Wed, Jun 6, 2018 at 7:35 AM Alistair Buxton ***@***.***> wrote:
My version of GitPython appears to use GitCmdObjectDB by default. In fact
my program does not work correctly if I tell it to use GitDB - it crashes
with "unexpected delta opcode 0", possibly related to the other bug I
reported.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#759 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD4hpmiP5OdaecgIqaAuER8C19lNo2oks5t52o5gaJpZM4UPJiu>
.
|
For the fun of it, I have created a small program which for now only effectively counts commits: https://github.com/Byron/git-count . It now uses the odb for iteration, and seems to produce acceptable results. |
Example code:
Output:
The same thing happens with obj.trees.
The text was updated successfully, but these errors were encountered: