diff --git a/crates/fs/src/fake_git_repo.rs b/crates/fs/src/fake_git_repo.rs index 589a6606b0087f2e27779f5bcf76b53ce8e5e3bf..d53d75cdfa13ca48acc34c07b4afd48f5cafc50d 100644 --- a/crates/fs/src/fake_git_repo.rs +++ b/crates/fs/src/fake_git_repo.rs @@ -255,12 +255,8 @@ impl GitRepository for FakeGitRepository { } let target_index = state.commit_history.len() - pop_count; - state.commit_history.truncate(target_index + 1); - let snapshot = state - .commit_history - .last() - .expect("pop_count validated above") - .clone(); + let snapshot = state.commit_history[target_index].clone(); + state.commit_history.truncate(target_index); match mode { ResetMode::Soft => {