librelist archives

« back to archive

tree_key_search broken in libgit2 at head.

tree_key_search broken in libgit2 at head.

From:
Han-Wen Nienhuys
Date:
2012-03-26 @ 16:03
Consider the script below.  It uses tree_key_search() to find an
entry, which obviously exists (see the assertion), but finding it
directly fails.

On a tangents: any updates on a 0.18 release ?

thanks,


#!/bin/sh
set -eux
DIR=$(mktemp -d /tmp/barf.XXXX)
cd $DIR
git init
mkdir b js j jt p v
echo hoi > A
echo hai > B
echo hey > _
echo hoi > b/x
echo hoi > j/x
echo hoi > js/x
echo hoi > jt/x
echo hoi > p/x
echo hoi > v/x

git add .
git commit -m 'test'

# Allow pygit to run.
cp $HOME/lvc/pygit2/*.so .
cp $HOME/lvc/libgit2/build/libgit*.so* .
export LD_LIBRARY_PATH=.

cat <<EOF > foo.py
import pygit2 as p
r = p.Repository('.')
c = r[r.lookup_reference('HEAD').resolve().oid]
want = 'jt'
found = False
for e in c.tree:
  found = found or e.name == want
assert found
barf = c.tree[want]

EOF
python foo.py


-- 
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen

Re: tree_key_search broken in libgit2 at head.

From:
Han-Wen Nienhuys
Date:
2012-03-26 @ 16:13
Also reported as https://github.com/libgit2/libgit2/issues/612

On Mon, Mar 26, 2012 at 1:03 PM, Han-Wen Nienhuys <hanwenn@gmail.com> wrote:
> Consider the script below.  It uses tree_key_search() to find an
> entry, which obviously exists (see the assertion), but finding it
> directly fails.
>
> On a tangents: any updates on a 0.18 release ?
>
> thanks,
>
>
> #!/bin/sh
> set -eux
> DIR=$(mktemp -d /tmp/barf.XXXX)
> cd $DIR
> git init
> mkdir b js j jt p v
> echo hoi > A
> echo hai > B
> echo hey > _
> echo hoi > b/x
> echo hoi > j/x
> echo hoi > js/x
> echo hoi > jt/x
> echo hoi > p/x
> echo hoi > v/x
>
> git add .
> git commit -m 'test'
>
> # Allow pygit to run.
> cp $HOME/lvc/pygit2/*.so .
> cp $HOME/lvc/libgit2/build/libgit*.so* .
> export LD_LIBRARY_PATH=.
>
> cat <<EOF > foo.py
> import pygit2 as p
> r = p.Repository('.')
> c = r[r.lookup_reference('HEAD').resolve().oid]
> want = 'jt'
> found = False
> for e in c.tree:
>  found = found or e.name == want
> assert found
> barf = c.tree[want]
>
> EOF
> python foo.py
>
>
> --
> Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



-- 
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen