Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
524 changes: 299 additions & 225 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ resolver = "2"
[workspace.dependencies]
bstr = "1.10.0"
# Add the `tracing` or `tracing-detail` features to see more of gitoxide in the logs. Useful to see which programs it invokes.
gix = { git = "https://github.com/Byron/gitoxide", rev = "d51f330e9d364c6f7b068116b59bf5c0160e47af", default-features = false, features = [
] }
gix = { git = "https://github.com/Byron/gitoxide", rev = "242fedc973c56b6c1b6f150af99dda972a67f547", default-features = false, features = [] }
git2 = { version = "0.18.3", features = [
"vendored-openssl",
"vendored-libgit2",
Expand All @@ -52,6 +51,8 @@ fslock = "0.2.1"
parking_lot = "0.12.3"
futures = "0.3.30"
toml = "0.8.13"
tracing = "0.1.40"
tracing-subscriber = "0.3.17"

gitbutler-id = { path = "crates/gitbutler-id" }
gitbutler-git = { path = "crates/gitbutler-git" }
Expand Down
6 changes: 3 additions & 3 deletions crates/gitbutler-branch-actions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ authors = ["GitButler <[email protected]>"]
publish = false

[dependencies]
tracing = "0.1.40"
tracing.workspace = true
anyhow = "1.0.86"
git2.workspace = true
gix.workspace = true
gix = { workspace = true, features = ["blob-diff"] }
tokio.workspace = true
gitbutler-oplog.workspace = true
gitbutler-repo.workspace = true
Expand Down Expand Up @@ -43,7 +43,7 @@ reqwest = { version = "0.12.4", features = ["json"] }
once_cell = "1.19"
pretty_assertions = "1.4"
gitbutler-testsupport.workspace = true
gix = { workspace = true, features = ["max-performance-safe"] }
gix = { workspace = true, features = ["max-performance"] }
gitbutler-git = { workspace = true, features = ["test-askpass-path"] }
glob = "0.3.1"
serial_test = "3.1.1"
Expand Down
73 changes: 71 additions & 2 deletions crates/gitbutler-branch-actions/benches/branches.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
use gitbutler_branch_actions::list_branches;
use gitbutler_branch_actions::{get_branch_listing_details, list_branches};
use gitbutler_command_context::CommandContext;
use gitbutler_project::Project;

Expand Down Expand Up @@ -50,5 +50,74 @@ pub fn benchmark_list_branches(c: &mut Criterion) {
}
}

criterion_group!(benches, benchmark_list_branches);
pub fn benchmark_branch_details(c: &mut Criterion) {
for (bench_name, (repo_name, branch_name, files_to_diff, script_name)) in [
(
"branch-details [many branches no change]",
("many-local", "virtual", 0, "branch-benches.sh"),
),
(
"branch-details [tiny no change]",
(
"one-vbranch-on-integration-two-remotes",
"main",
0,
"for-listing.sh",
),
),
(
"branch-details [big repo no change]",
(
"big-repo-clone",
"no-change",
0,
"branch-details-benches.sh",
),
),
(
"branch-details [every-file-changed]",
(
"big-repo-clone-one-commit-ahead",
"change-with-new-content",
10_000,
"branch-details-benches.sh",
),
),
] {
let mut group = c.benchmark_group(bench_name);
let project = fixture_project(repo_name, script_name);
if files_to_diff != 0 {
group.throughput(Throughput::Elements(files_to_diff));
}
group.bench_function("list details of known branch", |b| {
b.iter(|| {
let ctx = CommandContext::open(&project).unwrap();
let details =
get_branch_listing_details(black_box(&ctx), Some(branch_name)).unwrap();
assert_eq!(details.len(), 1, "{script_name}:{repo_name}:{branch_name}");
assert_eq!(
details[0].number_of_files, files_to_diff as usize,
"currently it creates a new vbranch for changes in local-commits, something we leverage here"
);
})
});
}

let mut group = c.benchmark_group("branch-details [revwalk]");
let project = fixture_project("revwalk-repo", "branch-details-benches.sh");
group.throughput(Throughput::Elements(100 + 15 + 50));
group.bench_function("count commits/collect authors", |b| {
b.iter(|| {
let ctx = CommandContext::open(&project).unwrap();
let details = get_branch_listing_details(
black_box(&ctx),
["feature", "main", "non-virtual-feature"],
)
.unwrap();
assert_eq!(details.len(), 3);
})
});
}

criterion_group!(benches, benchmark_list_branches, benchmark_branch_details);
criterion_main!(benches);
11 changes: 6 additions & 5 deletions crates/gitbutler-branch-actions/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,12 @@ fn _print_tree(repo: &git2::Repository, tree: &git2::Tree) -> Result<()> {
Ok(())
}

// try to update the target branch
// this means that we need to:
// determine if what the target branch is now pointing to is mergeable with our current working directory
// merge the target branch into our current working directory
// update the target sha
/// try to update the target branch
/// this means that we need to:
/// - determine if what the target branch is now pointing to is mergeable with our current working directory,
/// - merge the target branch into our current working directory
/// - update the target sha
/// - return all conflicting references that were unapplied to avoid the conflict
pub(crate) fn update_base_branch(
ctx: &CommandContext,
perm: &mut WorktreeWritePermission,
Expand Down
Loading