Skip to content

Commit

Permalink
Merge branch 'oid'
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	setup.winxed
  • Loading branch information
leto committed Nov 22, 2011
2 parents f517ed7 + 6077d63 commit a897347
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions setup.winxed
Expand Up @@ -44,6 +44,7 @@ function setup_stable_libraries(var parrot_libgit2) {
'Common',
'Index',
'Odb',
'Oid',
'RefCache',
'Repository'
];
Expand Down
25 changes: 25 additions & 0 deletions src/Git2/Oid.winxed
@@ -0,0 +1,25 @@
$include_const 'datatypes.pasm';
$include_const "iglobals.pasm";

namespace Git2 {
class Oid {
function get_sv() {
/*
typedef struct {
// raw binary formatted id
unsigned char id[GIT_OID_RAWSZ];
} git_oid;
*/

var sv = new 'StructView'([ DATATYPE_STRUCT, 1,
DATATYPE_PTR
]);

while (1) { yield(sv); }
}
var ptr;
function Oid() {
self.ptr = self.get_sv().alloc();
}
}
}
2 changes: 1 addition & 1 deletion src/git2.nci
Expand Up @@ -106,7 +106,7 @@ i git_odb_backend_pack pvvvv # git_odb_backend_pack
i git_oid_ncmp v # git_oid_ncmp
v git_oid_fromraw p # git_oid_fromraw
v git_oid_fmt p # git_oid_fmt
i git_oid_fromstr p # git_oid_fromstr
i git_oid_fromstr pp # git_oid_fromstr
i git_oid_cmp v # git_oid_cmp
p git_oid_allocfmt v # git_oid_allocfmt
i git_oid_fromstrn p # git_oid_fromstrn
Expand Down
2 changes: 1 addition & 1 deletion src/git2.pir
Expand Up @@ -185,7 +185,7 @@
set_global ['Git2';'Raw'], 'git_oid_fromraw', nci
dlfunc nci, lib, 'git_oid_fmt', 'vp'
set_global ['Git2';'Raw'], 'git_oid_fmt', nci
dlfunc nci, lib, 'git_oid_fromstr', 'ip'
dlfunc nci, lib, 'git_oid_fromstr', 'ipp'
set_global ['Git2';'Raw'], 'git_oid_fromstr', nci
dlfunc nci, lib, 'git_oid_cmp', 'iv'
set_global ['Git2';'Raw'], 'git_oid_cmp', nci
Expand Down
14 changes: 14 additions & 0 deletions t/winxed/001_load.t
Expand Up @@ -3,6 +3,9 @@
$load "rosella/test.pbc";
$load "./src/git2.pbc";
$load "./src/Git2/Common.pbc";
$load "./src/Git2/Oid.pbc";
$load "./src/Git2/Cache.pbc";
$load "./src/Git2/RefCache.pbc";
$load "./src/Git2/Repository.pbc";
$load "./src/Git2/Odb.pbc";
$load "./src/Git2/Cache.pbc";
Expand Down Expand Up @@ -93,6 +96,17 @@ class Test_git2_repository_open {
self.assert.instance_of(git_index, class Git2.Index);
}

function git_oid() {
var git_oid = new Git2.Oid();
using Git2.Raw.git_oid_fromstr;
self.assert.instance_of(git_oid, class Git2.Oid);

var hex = cstring("599955586da1c3ad514f3e65f1081d2012ec862d");
var rc1 = -1;
rc1 = git_oid_fromstr(git_oid.ptr, hex);
self.assert.defined(git_oid);
}

}
function main[main]() {
using Rosella.Test.test;
Expand Down

0 comments on commit a897347

Please sign in to comment.