Skip to content

Commit f517ed7

Browse files
committed
Start Git2.Odb class and add a test for git_repository_database
1 parent 8b80088 commit f517ed7

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ src/Git2/Common.pir
99
src/Git2/RefCache.pir
1010
src/Git2/Repository.pir
1111
src/Git2/Index.pir
12+
src/Git2/Oid.pir
13+
src/Git2/Odb.pir

setup.winxed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function setup_stable_libraries(var parrot_libgit2) {
4343
'Cache',
4444
'Common',
4545
'Index',
46+
'Odb',
4647
'RefCache',
4748
'Repository'
4849
];

src/Git2/Odb.winxed

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
$include_const 'datatypes.pasm';
2+
$include_const "iglobals.pasm";
3+
4+
namespace Git2 {
5+
class Odb {
6+
function get_sv() {
7+
/*
8+
typedef struct {
9+
} git_odb
10+
*/
11+
12+
var sv = new 'StructView'([ DATATYPE_STRUCT, 1,
13+
DATATYPE_PTR
14+
]);
15+
16+
while (1) { yield(sv); }
17+
}
18+
var ptr;
19+
function Odb() {
20+
self.ptr = self.get_sv().alloc();
21+
}
22+
}
23+
}

t/winxed/001_load.t

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ $load "rosella/test.pbc";
44
$load "./src/git2.pbc";
55
$load "./src/Git2/Common.pbc";
66
$load "./src/Git2/Repository.pbc";
7+
$load "./src/Git2/Odb.pbc";
8+
$load "./src/Git2/Cache.pbc";
9+
$load "./src/Git2/RefCache.pbc";
710
$load "dumper.pbc";
811

912
$include_const 'datatypes.pasm';
@@ -55,6 +58,7 @@ class Test_git2_repository_open {
5558
using Git2.Raw.git_repository_free;
5659
using Git2.Raw.git_index_open_inrepo;
5760
using Git2.Raw.git_repository_is_bare;
61+
using Git2.Raw.git_repository_database;
5862
using cstring;
5963

6064
var repo = new Git2.Repository();
@@ -77,6 +81,10 @@ class Test_git2_repository_open {
7781
var bool = git_repository_is_bare(repo.ptr);
7882
self.assert.equal(bool,0);
7983

84+
var odb = git_repository_database(repo.ptr);
85+
self.assert.defined(odb);
86+
87+
// coredumps inside libgit2
8088
// git_repository_free(repo.ptr);
8189
}
8290

0 commit comments

Comments
 (0)