Skip to content

Commit 8b003a0

Browse files
committed
[commitgraph] refactor file::init
1 parent c4b14c1 commit 8b003a0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

git-commitgraph/src/file/init.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl TryFrom<&Path> for File {
136136
let mut base_graphs_list_offset: Option<usize> = None;
137137
let mut commit_data_offset: Option<usize> = None;
138138
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;
140140
let mut fan_offset: Option<usize> = None;
141141
let mut oid_lookup_offset: Option<usize> = None;
142142
let mut oid_lookup_count = 0u32;
@@ -208,11 +208,11 @@ impl TryFrom<&Path> for File {
208208
commit_data_count = (chunk_size / COMMIT_DATA_ENTRY_SIZE) as u32;
209209
}
210210
EXTENDED_EDGES_LIST_CHUNK_ID => {
211-
if extended_edges_list_range.is_some() {
211+
if extra_edges_list_range.is_some() {
212212
return Err(Error::DuplicateChunk(chunk_id));
213213
}
214214

215-
extended_edges_list_range = Some(Range {
215+
extra_edges_list_range = Some(Range {
216216
start: chunk_offset,
217217
end: next_chunk_offset,
218218
})
@@ -245,6 +245,7 @@ impl TryFrom<&Path> for File {
245245
}
246246
oid_lookup_offset = Some(chunk_offset);
247247
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.
248249
// git allows extra garbage in the extra edges list chunk?
249250
// if oid_lookup_count > 0 {
250251
// let last_edge = &data[next_chunk_offset - 4..next_chunk_offset];
@@ -296,7 +297,7 @@ impl TryFrom<&Path> for File {
296297
base_graphs_list_offset,
297298
commit_data_offset,
298299
data,
299-
extra_edges_list_range: extended_edges_list_range,
300+
extra_edges_list_range,
300301
fan,
301302
oid_lookup_offset,
302303
path: path.to_owned(),

tasks.md

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
* **Questions**
2929
* ~~How can `Commit` return Graph positions? It doesn't seem to learn about an offset.~~
3030
* Parent IDs are indeed specified as graph positions, not file positions, as they may be in previous commit graph files.
31+
* What to do with the ['extra-garbage'](https://github.com/Byron/gitoxide/blob/6f90beeb418480f9cd8bb7ae3b5db678b24103cb/git-commitgraph/src/file/init.rs#L248),
32+
some code is commented out.
3133
* **Future Work**
3234
* A plumbing command to extract some value from the current implementation, maybe statistics, or verification
3335
* Application of the command above in a stress test

0 commit comments

Comments
 (0)