From e5c8252fb4a2dfd1fec90b30d8414266b9df0fa0 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 11 Dec 2023 20:33:41 +0900 Subject: [PATCH] index: use segment_parent_file() instead of direct field access --- lib/src/default_index/mutable.rs | 8 ++++---- lib/src/default_index/readonly.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/default_index/mutable.rs b/lib/src/default_index/mutable.rs index 6fc353c89..00c85542d 100644 --- a/lib/src/default_index/mutable.rs +++ b/lib/src/default_index/mutable.rs @@ -149,7 +149,7 @@ impl MutableIndexSegment { let other_ancestor = maybe_other_ancestor.as_ref().unwrap(); if maybe_own_ancestor.is_none() { files_to_add.push(other_ancestor.clone()); - maybe_other_ancestor = other_ancestor.parent_file.clone(); + maybe_other_ancestor = other_ancestor.segment_parent_file().cloned(); continue; } let own_ancestor = maybe_own_ancestor.as_ref().unwrap(); @@ -160,9 +160,9 @@ impl MutableIndexSegment { < other_ancestor.as_composite().num_commits() { files_to_add.push(other_ancestor.clone()); - maybe_other_ancestor = other_ancestor.parent_file.clone(); + maybe_other_ancestor = other_ancestor.segment_parent_file().cloned(); } else { - maybe_own_ancestor = own_ancestor.parent_file.clone(); + maybe_own_ancestor = own_ancestor.segment_parent_file().cloned(); } } @@ -254,7 +254,7 @@ impl MutableIndexSegment { } num_new_commits += parent_file.segment_num_commits(); files_to_squash.push(parent_file.clone()); - maybe_parent_file = parent_file.parent_file.clone(); + maybe_parent_file = parent_file.segment_parent_file().cloned(); } None => { squashed = diff --git a/lib/src/default_index/readonly.rs b/lib/src/default_index/readonly.rs index ad50cbd81..1e1259af1 100644 --- a/lib/src/default_index/readonly.rs +++ b/lib/src/default_index/readonly.rs @@ -123,7 +123,7 @@ impl CommitLookupEntry<'_> { // ids // TODO: add a fanout table like git's commit graph has? pub(super) struct ReadonlyIndexSegment { - pub(super) parent_file: Option>, + parent_file: Option>, pub(super) num_parent_commits: u32, pub(super) name: String, pub(super) commit_id_length: usize,