History

[commitgraph] refactor file::init

Sebastian Thiel committed 6 years ago

Commit 8b003a01 parent c4b14c12 files · +7 −4Browse files

Showing the changes to git-commitgraph/src (1 of 2 files). Show all

Unified · Split

git-commitgraph/src/file/init.rs+5−4
@@ -136,7 +136,7 @@ impl TryFrom<&Path> for File { · 135 unmodified lines
136 let mut base_graphs_list_offset: Option<usize> = None;136 let mut base_graphs_list_offset: Option<usize> = None;
137 let mut commit_data_offset: Option<usize> = None;137 let mut commit_data_offset: Option<usize> = None;
138 let mut commit_data_count = 0u32;138 let mut commit_data_count = 0u32;
139 let mut extended_edges_list_range: Option<Range<usize>> = None;139 let mut extra_edges_list_range: Option<Range<usize>> = None;
140 let mut fan_offset: Option<usize> = None;140 let mut fan_offset: Option<usize> = None;
141 let mut oid_lookup_offset: Option<usize> = None;141 let mut oid_lookup_offset: Option<usize> = None;
142 let mut oid_lookup_count = 0u32;142 let mut oid_lookup_count = 0u32;
@@ -208,11 +208,11 @@ impl TryFrom<&Path> for File { · 65 unmodified lines
208 commit_data_count = (chunk_size / COMMIT_DATA_ENTRY_SIZE) as u32;208 commit_data_count = (chunk_size / COMMIT_DATA_ENTRY_SIZE) as u32;
209 }209 }
210 EXTENDED_EDGES_LIST_CHUNK_ID => {210 EXTENDED_EDGES_LIST_CHUNK_ID => {
211 if extended_edges_list_range.is_some() {211 if extra_edges_list_range.is_some() {
212 return Err(Error::DuplicateChunk(chunk_id));212 return Err(Error::DuplicateChunk(chunk_id));
213 }213 }
214 214
215 extended_edges_list_range = Some(Range {215 extra_edges_list_range = Some(Range {
216 start: chunk_offset,216 start: chunk_offset,
217 end: next_chunk_offset,217 end: next_chunk_offset,
218 })218 })
@@ -245,6 +245,7 @@ impl TryFrom<&Path> for File { · 26 unmodified lines
245 }245 }
246 oid_lookup_offset = Some(chunk_offset);246 oid_lookup_offset = Some(chunk_offset);
247 oid_lookup_count = (chunk_size / OID_LOOKUP_ENTRY_SIZE) as u32;247 oid_lookup_count = (chunk_size / OID_LOOKUP_ENTRY_SIZE) as u32;
248 // TODO(ST): Figure out how to handle this. Don't know what to do with the commented code.
248 // git allows extra garbage in the extra edges list chunk?249 // git allows extra garbage in the extra edges list chunk?
249 // if oid_lookup_count > 0 {250 // if oid_lookup_count > 0 {
250 // let last_edge = &data[next_chunk_offset - 4..next_chunk_offset];251 // let last_edge = &data[next_chunk_offset - 4..next_chunk_offset];
@@ -296,7 +297,7 @@ impl TryFrom<&Path> for File { · 45 unmodified lines
296 base_graphs_list_offset,297 base_graphs_list_offset,
297 commit_data_offset,298 commit_data_offset,
298 data,299 data,
299 extra_edges_list_range: extended_edges_list_range,300 extra_edges_list_range,
300 fan,301 fan,
301 oid_lookup_offset,302 oid_lookup_offset,
302 path: path.to_owned(),303 path: path.to_owned(),