Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Refactor Git2.Repository and winxed tests

  • Loading branch information...
commit 8ae4454474d9fb3b9992821c750336ec9e3c3e26 1 parent 5a71fec
Duke Leto leto authored

Showing 2 changed files with 11 additions and 8 deletions. Show diff stats Hide diff stats

  1. +7 3 src/Git2/Repository.winxed
  2. +4 5 t/winxed/001_load.t
10 src/Git2/Repository.winxed
@@ -43,8 +43,8 @@ struct git_repository {
43 43
44 44 class Git2.Repository {
45 45 var ptr;
46   - function Repository() {
47   - var repo_sv = new 'StructView'([ DATATYPE_STRUCT, 9,
  46 + function get_sv() {
  47 + var sv = new 'StructView'([ DATATYPE_STRUCT, 9,
48 48 DATATYPE_PTR,
49 49 DATATYPE_SIZED, git_cache.size(), git_cache.align(),
50 50 DATATYPE_SIZED, git_refcache.size(), git_refcache.align(),
@@ -55,6 +55,10 @@ class Git2.Repository {
55 55 DATATYPE_UINT,
56 56 DATATYPE_UINT
57 57 ]);
58   - self.ptr = repo_sv.alloc();
  58 + while (1) { yield(sv); }
  59 + }
  60 + function Repository() {
  61 + var sv = get_sv();
  62 + self.ptr = sv.alloc();
59 63 }
60 64 }
9 t/winxed/001_load.t
@@ -36,20 +36,19 @@ class Test_git2_repository_open {
36 36 }
37 37
38 38 function open_repo() {
39   - using Git2.ptr.git_repository_open;
  39 + using Git2.Repository;
40 40 using cstring;
41 41
42 42 var repo = new Git2.Repository;
43   - var rc;
44 43
45   - rc = git_repository_open(repo.ptr, cstring(".git"));
  44 + var rc = git_repository_open(repo.ptr, cstring(".git"));
46 45
47 46 self.assert.equal(rc,0);
48 47 }
49 48
50 49 function repository_index() {
51   - using Git2.ptr.git_repository_open;
52   - using Git2.ptr.git_repository_index;
  50 + using Git2.Repository;
  51 + using Git2.Index;
53 52 using cstring;
54 53
55 54 var repo = new Git2.Repository;

0 comments on commit 8ae4454

Please sign in to comment.
Something went wrong with that request. Please try again.