librelist archives

« back to archive

curious behavior of treebuilder

curious behavior of treebuilder

From:
Sakari Jokinen
Date:
2011-05-28 @ 19:30
I noticed that if I insert three entries to a tree builder
   "ba"  040000   (<- directory)
   "b"    0
   "a"    0
git_treebuilder_write and lookup the tree with the resulting oid the
tree does not contain the entry "b" (or it is not found with
git_tree_entry_byname). If I
skip the insertion of either "ba" or "a" then "b" is found. This
happens in both development
and master branches.

I first noticed this as I was (slowly) progressing on testing my
haskell bindings, but
I also created a test case for libgit2 to reproduce this if anyone
would be interested to
have a look:  
https://github.com/sakari/libgit2/tree/failing-tree-entry-byname-lookup

What am I doing wrong here?

Sakari

Re: [libgit2] curious behavior of treebuilder

From:
Emeric Fermas
Date:
2011-05-28 @ 20:09
Hey,

In order to ease with the troubleshooting of this, could you please
create an issue as well
(https://github.com/libgit2/libgit2/issues/new)?

>have a look:  
https://github.com/sakari/libgit2/tree/failing-tree-entry-byname-lookup
direct commit link:
https://github.com/sakari/libgit2/commit/8af9b61663dbee227620f02a53260524c24de779

Thanks in advance,

Cheers,
Em.



On Sat, May 28, 2011 at 9:30 PM, Sakari Jokinen <sakariij@gmail.com> wrote:
> I noticed that if I insert three entries to a tree builder
>   "ba"  040000   (<- directory)
>   "b"    0
>   "a"    0
> git_treebuilder_write and lookup the tree with the resulting oid the
> tree does not contain the entry "b" (or it is not found with
> git_tree_entry_byname). If I
> skip the insertion of either "ba" or "a" then "b" is found. This
> happens in both development
> and master branches.
>
> I first noticed this as I was (slowly) progressing on testing my
> haskell bindings, but
> I also created a test case for libgit2 to reproduce this if anyone
> would be interested to
> have a look: 
 https://github.com/sakari/libgit2/tree/failing-tree-entry-byname-lookup
>
> What am I doing wrong here?
>
> Sakari
>

Re: [libgit2] curious behavior of treebuilder

From:
Sakari Jokinen
Date:
2011-05-28 @ 20:45
On Sat, May 28, 2011 at 11:09 PM, Emeric Fermas <emeric.fermas@gmail.com> wrote:
> In order to ease with the troubleshooting of this, could you please
> create an issue as well
> (https://github.com/libgit2/libgit2/issues/new)?

created https://github.com/libgit2/libgit2/issues/214

I take that this is something that should work? I did not create an
issue as I was unsure whether I
was just using the api wrong.

Sakari