Skip to content

Commit 09dde88

Browse files
committed
Debug performance around the new checkout
1 parent 8dfeeab commit 09dde88

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

crates/but-testing/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub enum Subcommands {
147147
/// As StackIDs are going away, BranchDetails would be the part that remains.
148148
StackDetails {
149149
/// The ID of the stack to list details for.
150-
id: StackId,
150+
id: Option<StackId>,
151151
},
152152
/// Returns detailed
153153
BranchDetails {

crates/but-testing/src/command/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,19 @@ pub mod stacks {
196196
}
197197
}
198198

199-
pub fn details(id: StackId, current_dir: &Path, v3: bool) -> anyhow::Result<()> {
199+
pub fn details(id: Option<StackId>, current_dir: &Path, v3: bool) -> anyhow::Result<()> {
200200
let project = project_from_path(current_dir)?;
201201
let ctx = CommandContext::open(&project, AppSettings::default())?;
202202
let details = if v3 {
203203
let meta = ref_metadata_toml(ctx.project())?;
204204
let repo = ctx.gix_repo_for_merging_non_persisting()?;
205-
but_workspace::stack_details_v3(id.into(), &repo, &meta)
205+
but_workspace::stack_details_v3(id, &repo, &meta)
206206
} else {
207-
but_workspace::stack_details(&project.gb_dir(), id, &ctx)
207+
but_workspace::stack_details(
208+
&project.gb_dir(),
209+
id.context("a StackID is needed for the old implementation")?,
210+
&ctx,
211+
)
208212
}?;
209213
debug_print(details)
210214
}

crates/but-workspace/src/stacks.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,18 @@ pub fn stack_details_v3(
441441
.into_iter()
442442
.find_map(|(id, stack)| (id == stack_id).then_some(stack)))
443443
}
444-
let ref_info_options = ref_info::Options {
444+
let mut ref_info_options = ref_info::Options {
445445
// TODO(perf): make this so it can be enabled for a specific stack-id.
446446
expensive_commit_info: true,
447447
traversal: meta.graph_options(),
448448
};
449449
let mut stack = match stack_id {
450450
None => {
451451
// assume single-branch mode.
452+
// Make sure the UI isn't overwhelmed, this currently happens easily on some repos where a lot of commits
453+
// would otherwise be returned. The problem is that then the workspace might not be correct, but there isn't
454+
// another way that still allows to extend the range via gas-stations. Maybe one day we won't need this.
455+
ref_info_options.traversal.hard_limit = Some(500);
452456
let mut info = head_info(repo, meta, ref_info_options)?;
453457
if info.stacks.len() != 1 {
454458
bail!(

0 commit comments

Comments
 (0)