-
-
Notifications
You must be signed in to change notification settings - Fork 400
Description
When iterating over the entries in a Tree, it seems like some entries appear in the iteration, but can't be retrieved by using the entry name as an index to the Tree object. I noticed this when trying to read the Git repository for the Linux kernel. There are some tree entries in 'include/linux' which show the problem. The tree entries / directories named 'can', 'hdlc', 'i2c', 'input', 'netfilter_bridge', 'rtc' and 'wimax' all show up in the list of entries when iterating over the tree for the directory 'include/linux', but can't be retrieved by, e.g., tree['can'] - this throws a KeyError.
I uploaded a small gist which shows up the problem: https://gist.github.com/3bcc088234d2de488258
One common feature to all of these is that there are also files which have the directory name as a prefix in the tree, e.g. 'can.h', 'hdlc.h'. Other entries, including directories like 'dvb', can be retrieved from the Tree object by name.
As far as I can see, Tree objects are supposed to be index-able by the names of entries in the Tree, as well as by a numeric index. Assuming this is correct, it looks like a bug in either pygit2 or libgit2.
I'm using the latest revisions of pygit2 (28b1deb) and libgit2 (77bb37eb47647180c0ed30517f6c6e4c219d131a). The operating system is Ubuntu 10.04.3, and the Python / GCC versions are:
$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)