File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -2619,6 +2619,8 @@ extern "C" {
26192619 ) -> c_int ;
26202620
26212621 // index
2622+ pub fn git_index_version ( index : * mut git_index ) -> c_uint ;
2623+ pub fn git_index_set_version ( index : * mut git_index , version : c_uint ) -> c_int ;
26222624 pub fn git_index_add ( index : * mut git_index , entry : * const git_index_entry ) -> c_int ;
26232625 pub fn git_index_add_all (
26242626 index : * mut git_index ,
Original file line number Diff line number Diff line change @@ -117,6 +117,27 @@ impl Index {
117117 }
118118 }
119119
120+ /// Get index on-disk version.
121+ ///
122+ /// Valid return values are 2, 3, or 4. If 3 is returned, an index
123+ /// with version 2 may be written instead, if the extension data in
124+ /// version 3 is not necessary.
125+ pub fn version ( & self ) -> u32 {
126+ unsafe { raw:: git_index_version ( self . raw ) }
127+ }
128+
129+ /// Set index on-disk version.
130+ ///
131+ /// Valid values are 2, 3, or 4. If 2 is given, git_index_write may
132+ /// write an index with version 3 instead, if necessary to accurately
133+ /// represent the index.
134+ pub fn set_version ( & mut self , version : u32 ) -> Result < ( ) , Error > {
135+ unsafe {
136+ try_call ! ( raw:: git_index_set_version( self . raw, version) ) ;
137+ }
138+ Ok ( ( ) )
139+ }
140+
120141 /// Add or update an index entry from an in-memory struct
121142 ///
122143 /// If a previous index entry exists that has the same path and stage as the
You can’t perform that action at this time.
0 commit comments