File tree 4 files changed +16
-8
lines changed 4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 2
2
name = " libgit2-rs"
3
3
version = " 0.1.0"
4
4
authors = [
" You <[email protected] >" ]
5
- build = " build.rs "
5
+ edition = " 2018 "
6
6
7
7
[dependencies ]
Original file line number Diff line number Diff line change 1
1
fn main ( ) {
2
- println ! ( "cargo:rustc-link-search=native=/home/jimb/libgit2-0.25.1/build" ) ;
2
+ println ! ( r "cargo:rustc-link-search=native=/home/jimb/libgit2-0.25.1/build") ;
3
3
}
Original file line number Diff line number Diff line change
1
+ #![ warn( rust_2018_idioms) ]
2
+ #![ allow( elided_lifetimes_in_paths) ]
3
+
1
4
mod raw;
2
5
3
6
use std:: ffi:: CStr ;
@@ -48,9 +51,12 @@ fn main() {
48
51
raw:: git_repository_open ( & mut repo, path. as_ptr ( ) ) ) ;
49
52
50
53
let c_name = b"HEAD\0 " . as_ptr ( ) as * const c_char ;
51
- let mut oid = mem:: uninitialized ( ) ;
52
- check ( "looking up HEAD" ,
53
- raw:: git_reference_name_to_id ( & mut oid, repo, c_name) ) ;
54
+ let oid = {
55
+ let mut oid = mem:: MaybeUninit :: uninit ( ) ;
56
+ check ( "looking up HEAD" ,
57
+ raw:: git_reference_name_to_id ( oid. as_mut_ptr ( ) , repo, c_name) ) ;
58
+ oid. assume_init ( )
59
+ } ;
54
60
55
61
let mut commit = ptr:: null_mut ( ) ;
56
62
check ( "looking up commit" ,
Original file line number Diff line number Diff line change @@ -25,18 +25,20 @@ extern {
25
25
pub fn git_commit_free ( commit : * mut git_commit ) ;
26
26
}
27
27
28
- pub enum git_repository { }
29
- pub enum git_commit { }
28
+ # [ repr ( C ) ] pub struct git_repository { _private : [ u8 ; 0 ] }
29
+ # [ repr ( C ) ] pub struct git_commit { _private : [ u8 ; 0 ] }
30
30
31
31
#[ repr( C ) ]
32
32
pub struct git_error {
33
33
pub message : * const c_char ,
34
34
pub klass : c_int
35
35
}
36
36
37
+ pub const GIT_OID_RAWSZ : usize = 20 ;
38
+
37
39
#[ repr( C ) ]
38
40
pub struct git_oid {
39
- pub id : [ c_uchar ; 20 ]
41
+ pub id : [ c_uchar ; GIT_OID_RAWSZ ]
40
42
}
41
43
42
44
pub type git_time_t = i64 ;
You can’t perform that action at this time.
0 commit comments