Skip to content
Merged
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
24 changes: 7 additions & 17 deletions src/weave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,7 @@ impl Weave {
let candidate_set: HashSet<Oid> = candidates.into_iter().collect();
match cherry_pick_equivalents(workdir, &new_upstream_oid, &self.base_oid) {
Some(equivalent) => {
for oid in equivalent {
if candidate_set.contains(&oid) {
to_drop.push(oid);
}
}
to_drop.extend(equivalent.intersection(&candidate_set).copied());
}
None => {
msg::warn(
Expand Down Expand Up @@ -1269,20 +1265,14 @@ pub fn run_rebase(
/// O(upstream commits). `git cherry` uses the same patch-ID logic internally
/// and respects diff.algorithm consistently.
fn cherry_pick_equivalents(workdir: &Path, upstream: &Oid, base: &Oid) -> Option<HashSet<Oid>> {
use std::process::Command;

let output = Command::new("git")
.current_dir(workdir)
.args(["cherry", &upstream.to_string(), "HEAD", &base.to_string()])
.output()
.ok()?;

if !output.status.success() {
return None;
}
let stdout = git_commands::run_git_stdout(
workdir,
&["cherry", &upstream.to_string(), "HEAD", &base.to_string()],
)
.ok()?;

Some(
String::from_utf8_lossy(&output.stdout)
stdout
.lines()
.filter_map(|line| {
line.strip_prefix("- ")
Expand Down
Loading