From 297a0ebb68e42013c10952959f33f1faa14a78bf Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 23 Jun 2024 19:48:30 +0900 Subject: [PATCH] cli: stop using shared id prefix context to compute immutable heads It's unlikely that the immutable set is defined by short hashes, and more importantly, the cache must not be initialized by using tx.repo(). --- cli/src/cli_util.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index 2363a6a31..a72e89e9f 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -1112,6 +1112,11 @@ impl WorkspaceCommandHelper { Ok(()) }; } + + // Not using self.id_prefix_context() because the disambiguation data + // must not be calculated and cached against arbitrary repo. It's also + // unlikely that the immutable expression contains short hashes. + let id_prefix_context = IdPrefixContext::new(self.revset_extensions.clone()); let to_rewrite_revset = RevsetExpression::commits(commits.into_iter().cloned().collect_vec()); let immutable = revset_util::parse_immutable_expression(&self.revset_parse_context()) @@ -1121,7 +1126,7 @@ impl WorkspaceCommandHelper { let mut expression = RevsetExpressionEvaluator::new( repo, self.revset_extensions.clone(), - self.id_prefix_context()?, + &id_prefix_context, immutable, ); expression.intersect_with(&to_rewrite_revset);