@@ -37,9 +37,9 @@ VALUE rb_cRuggedOdb;
37
37
* needs to be assigned using `Odb#add_backend`.
38
38
*/
39
39
static VALUE rb_git_odb_new (VALUE klass ) {
40
- git_odb * odb ;
41
- rugged_exception_check (git_odb_new (& odb ));
42
- return Data_Wrap_Struct (klass , NULL , git_odb_free , odb );
40
+ git_odb * odb ;
41
+ rugged_exception_check (git_odb_new (& odb ));
42
+ return Data_Wrap_Struct (klass , NULL , git_odb_free , odb );
43
43
}
44
44
45
45
/*
@@ -52,13 +52,13 @@ static VALUE rb_git_odb_new(VALUE klass) {
52
52
* `dir` needs to boint to the objects folder to be used
53
53
* by the filesystem backends.
54
54
*/
55
- static VALUE rb_git_odb_open (VALUE klass , VALUE rb_path ) {
56
- git_odb * odb ;
55
+ static VALUE rb_git_odb_open (VALUE klass , VALUE rb_path ) {
56
+ git_odb * odb ;
57
57
58
- rugged_exception_check (git_odb_open (& odb , StringValueCStr (rb_path )));
58
+ rugged_exception_check (git_odb_open (& odb , StringValueCStr (rb_path )));
59
59
60
- return Data_Wrap_Struct (klass , NULL , git_odb_free , odb );
61
- }
60
+ return Data_Wrap_Struct (klass , NULL , git_odb_free , odb );
61
+ }
62
62
63
63
/*
64
64
* call-seq:
@@ -72,59 +72,59 @@ static VALUE rb_git_odb_new(VALUE klass) {
72
72
*/
73
73
static VALUE rb_git_odb_add_backend (VALUE self , VALUE rb_backend , VALUE rb_priority )
74
74
{
75
- git_odb * odb ;
76
- git_odb_backend * backend ;
75
+ git_odb * odb ;
76
+ git_odb_backend * backend ;
77
77
78
- Data_Get_Struct (self , git_odb , odb );
79
- Data_Get_Struct (rb_backend , git_odb_backend , backend );
78
+ Data_Get_Struct (self , git_odb , odb );
79
+ Data_Get_Struct (rb_backend , git_odb_backend , backend );
80
80
81
- if (!backend )
82
- rb_exc_raise (rb_exc_new2 (rb_eRuntimeError , "Can not reuse odb backend instances" ));
81
+ if (!backend )
82
+ rb_exc_raise (rb_exc_new2 (rb_eRuntimeError , "Can not reuse odb backend instances" ));
83
83
84
- rugged_exception_check (git_odb_add_backend (odb , backend , NUM2INT (rb_priority )));
84
+ rugged_exception_check (git_odb_add_backend (odb , backend , NUM2INT (rb_priority )));
85
85
86
- // libgit2 has taken ownership of the backend, so we should make sure
87
- // we don't try to free it.
88
- ((struct RData * )rb_backend )-> data = NULL ;
86
+ // libgit2 has taken ownership of the backend, so we should make sure
87
+ // we don't try to free it.
88
+ ((struct RData * )rb_backend )-> data = NULL ;
89
89
90
- return self ;
90
+ return self ;
91
91
}
92
92
93
93
static int cb_odb__each (const git_oid * id , void * data )
94
94
{
95
- char out [40 ];
95
+ char out [40 ];
96
96
struct rugged_cb_payload * payload = data ;
97
97
98
- git_oid_fmt (out , id );
99
- rb_protect (rb_yield , rb_str_new (out , 40 ), & payload -> exception );
98
+ git_oid_fmt (out , id );
99
+ rb_protect (rb_yield , rb_str_new (out , 40 ), & payload -> exception );
100
100
101
- return payload -> exception ? GIT_ERROR : GIT_OK ;
101
+ return payload -> exception ? GIT_ERROR : GIT_OK ;
102
102
}
103
103
104
104
static VALUE rb_git_odb_each (VALUE self )
105
105
{
106
- git_odb * odb ;
107
- int error ;
108
- struct rugged_cb_payload payload = { self , 0 };
106
+ git_odb * odb ;
107
+ int error ;
108
+ struct rugged_cb_payload payload = { self , 0 };
109
109
110
- Data_Get_Struct (self , git_odb , odb );
110
+ Data_Get_Struct (self , git_odb , odb );
111
111
112
- error = git_odb_foreach (odb , & cb_odb__each , & payload );
112
+ error = git_odb_foreach (odb , & cb_odb__each , & payload );
113
113
114
114
if (payload .exception )
115
115
rb_jump_tag (payload .exception );
116
116
rugged_exception_check (error );
117
117
118
- return Qnil ;
118
+ return Qnil ;
119
119
}
120
120
121
121
void Init_rugged_odb (void )
122
122
{
123
123
rb_cRuggedOdb = rb_define_class_under (rb_mRugged , "Odb" , rb_cObject );
124
124
125
- rb_define_singleton_method (rb_cRuggedOdb , "new" , rb_git_odb_new , 0 );
125
+ rb_define_singleton_method (rb_cRuggedOdb , "new" , rb_git_odb_new , 0 );
126
126
rb_define_singleton_method (rb_cRuggedOdb , "open" , rb_git_odb_open , 1 );
127
127
128
128
rb_define_method (rb_cRuggedOdb , "add_backend" , rb_git_odb_add_backend , 2 );
129
- rb_define_method (rb_cRuggedOdb , "each" , rb_git_odb_each , 0 );
129
+ rb_define_method (rb_cRuggedOdb , "each" , rb_git_odb_each , 0 );
130
130
}
0 commit comments