mirror of
https://github.com/martinvonz/jj.git
synced 2024-10-23 15:00:17 +00:00
index: make first level in stats be the root index
I've confused myself a few times already thinking that level 0 is the root, so that's probably more intuitive. It also makes tests simpler because the initial part of the list is unchanged when a new transaction commits.
This commit is contained in:
parent
b122f33312
commit
a51543b752
2 changed files with 3 additions and 2 deletions
|
@ -591,6 +591,7 @@ impl<'a> CompositeIndex<'a> {
|
|||
});
|
||||
parent_file = file.segment_parent_file().clone();
|
||||
}
|
||||
levels.reverse();
|
||||
|
||||
IndexStats {
|
||||
num_commits,
|
||||
|
|
|
@ -387,8 +387,8 @@ fn test_index_commits_incremental_empty_transaction(use_git: bool) {
|
|||
assert_eq!(stats.num_merges, 0);
|
||||
assert_eq!(stats.max_generation_number, 1);
|
||||
assert_eq!(stats.levels.len(), 2);
|
||||
assert_eq!(stats.levels[0].num_commits, 1);
|
||||
assert_eq!(stats.levels[1].num_commits, 2);
|
||||
assert_eq!(stats.levels[0].num_commits, 2);
|
||||
assert_eq!(stats.levels[1].num_commits, 1);
|
||||
|
||||
assert_eq!(generation_number(index.clone(), root_commit.id()), 0);
|
||||
assert_eq!(generation_number(index.clone(), commit_a.id()), 1);
|
||||
|
|
Loading…
Reference in a new issue