ok/jj
1
0
Fork 0
forked from mirrors/jj

tests: in .gitignore test, explicitly save working copy state

One of the .gitignore tests writes a tree from the working copy
twice. However, it discards the `LockedWorkingCopy` instance after the
first write, so the second write shouldn't really see the changes from
the first write. It does see them because we don't clear them in
memory (and we also surprisingly write them to disk). I'm about to fix
that, so the test needs to be fixed first.
This commit is contained in:
Martin von Zweigbergk 2022-02-06 22:18:17 -08:00
parent 819ad475f5
commit d24cf15f2d

View file

@ -435,7 +435,12 @@ fn test_gitignores(use_git: bool) {
let wc = test_workspace.workspace.working_copy_mut();
let mut locked_wc = wc.start_mutation();
let new_tree_id1 = locked_wc.write_tree();
locked_wc.discard();
let mut tx = repo.start_transaction("test");
let initial_commit =
CommitBuilder::for_new_commit(&settings, repo.store(), new_tree_id1.clone())
.write_to_repo(tx.mut_repo());
let repo = tx.commit();
locked_wc.finish(repo.op_id().clone(), initial_commit.id().clone());
let tree1 = repo
.store()
.get_tree(&RepoPath::root(), &new_tree_id1)