File tree Expand file tree Collapse file tree 7 files changed +30
-2
lines changed Expand file tree Collapse file tree 7 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -557,6 +557,14 @@ impl State {
557
557
pub fn fs_monitor ( & self ) -> Option < & extension:: FsMonitor > {
558
558
self . fs_monitor . as_ref ( )
559
559
}
560
+ /// Return `true` if the end-of-index extension was present when decoding this index.
561
+ pub fn had_end_of_index_marker ( & self ) -> bool {
562
+ self . end_of_index_at_decode_time
563
+ }
564
+ /// Return `true` if the offset-table extension was present when decoding this index.
565
+ pub fn had_offset_table ( & self ) -> bool {
566
+ self . offset_table_at_decode_time
567
+ }
560
568
}
561
569
562
570
#[ cfg( test) ]
Original file line number Diff line number Diff line change @@ -134,6 +134,8 @@ fn load_one<'a>(
134
134
( path, skip_padding ( data, first_byte_of_entry) )
135
135
} ;
136
136
137
+ // TODO(perf): for some reason, this causes tremendous `memmove` time even though the backing
138
+ // has enough capacity most of the time.
137
139
path_backing. extend_from_slice ( path) ;
138
140
data
139
141
} ;
Original file line number Diff line number Diff line change @@ -236,6 +236,8 @@ impl State {
236
236
untracked,
237
237
fs_monitor,
238
238
is_sparse : is_sparse_from_ext, // a marker is needed in case there are no directories
239
+ end_of_index,
240
+ offset_table,
239
241
} = ext;
240
242
is_sparse |= is_sparse_from_ext;
241
243
@@ -248,6 +250,8 @@ impl State {
248
250
path_backing,
249
251
is_sparse,
250
252
253
+ end_of_index_at_decode_time : end_of_index,
254
+ offset_table_at_decode_time : offset_table,
251
255
tree,
252
256
link,
253
257
resolve_undo,
Original file line number Diff line number Diff line change @@ -50,8 +50,12 @@ pub(crate) fn all(
50
50
extension:: fs_monitor:: SIGNATURE => {
51
51
ext. fs_monitor = extension:: fs_monitor:: decode ( ext_data) ;
52
52
}
53
- extension:: end_of_index_entry:: SIGNATURE => { } // skip already done
54
- extension:: index_entry_offset_table:: SIGNATURE => { } // not relevant/obtained already
53
+ extension:: end_of_index_entry:: SIGNATURE => {
54
+ ext. end_of_index = true ;
55
+ } // skip already done
56
+ extension:: index_entry_offset_table:: SIGNATURE => {
57
+ ext. offset_table = true ;
58
+ } // not relevant/obtained already
55
59
mandatory if mandatory[ 0 ] . is_ascii_lowercase ( ) => match mandatory {
56
60
extension:: link:: SIGNATURE => ext. link = extension:: link:: decode ( ext_data, object_hash) ?. into ( ) ,
57
61
extension:: sparse:: SIGNATURE => {
@@ -77,4 +81,6 @@ pub(crate) struct Outcome {
77
81
pub untracked : Option < extension:: UntrackedCache > ,
78
82
pub fs_monitor : Option < extension:: FsMonitor > ,
79
83
pub is_sparse : bool ,
84
+ pub offset_table : bool ,
85
+ pub end_of_index : bool ,
80
86
}
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ mod from_tree {
26
26
resolve_undo : None ,
27
27
untracked : None ,
28
28
fs_monitor : None ,
29
+ offset_table_at_decode_time : false ,
30
+ end_of_index_at_decode_time : false ,
29
31
}
30
32
}
31
33
/// Create an index [`State`] by traversing `tree` recursively, accessing sub-trees
@@ -63,6 +65,8 @@ mod from_tree {
63
65
resolve_undo : None ,
64
66
untracked : None ,
65
67
fs_monitor : None ,
68
+ offset_table_at_decode_time : false ,
69
+ end_of_index_at_decode_time : false ,
66
70
} )
67
71
}
68
72
}
Original file line number Diff line number Diff line change @@ -128,6 +128,8 @@ pub struct State {
128
128
is_sparse : bool ,
129
129
130
130
// Extensions
131
+ end_of_index_at_decode_time : bool ,
132
+ offset_table_at_decode_time : bool ,
131
133
tree : Option < extension:: Tree > ,
132
134
link : Option < extension:: Link > ,
133
135
resolve_undo : Option < extension:: resolve_undo:: Paths > ,
Original file line number Diff line number Diff line change @@ -227,6 +227,8 @@ fn file_with_conflicts() {
227
227
fn v4_with_delta_paths_and_ieot_ext ( ) {
228
228
let file = file ( "v4_more_files_IEOT" ) ;
229
229
assert_eq ! ( file. version( ) , Version :: V4 ) ;
230
+ assert ! ( file. had_end_of_index_marker( ) ) ;
231
+ assert ! ( file. had_offset_table( ) ) ;
230
232
231
233
assert_eq ! ( file. entries( ) . len( ) , 10 ) ;
232
234
for ( idx, path) in [
You can’t perform that action at this time.
0 commit comments