Skip to content

Commit

Permalink
Merge pull request #689 from epage/fix
Browse files Browse the repository at this point in the history
fix(commit): Be more nuanced with `cargo release commit`s consolidated commit
  • Loading branch information
epage committed Jun 26, 2023
2 parents c8bc39d + 762fa14 commit e05ddbe
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/steps/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl CommitStep {

let pkgs = plan::plan(pkgs)?;

let (selected_pkgs, _excluded_pkgs): (Vec<_>, Vec<_>) = pkgs
let (selected_pkgs, excluded_pkgs): (Vec<_>, Vec<_>) = pkgs
.into_iter()
.map(|(_, pkg)| pkg)
.partition(|p| p.config.release());
Expand Down Expand Up @@ -90,7 +90,20 @@ impl CommitStep {
// STEP 1: Release Confirmation
super::confirm("Commit", &selected_pkgs, self.no_confirm, dry_run)?;

super::commit::workspace_commit(&ws_meta, &ws_config, &selected_pkgs, dry_run)?;
if ws_config.is_workspace {
let consolidate_commits = super::consolidate_commits(&selected_pkgs, &excluded_pkgs)?;
if !consolidate_commits {
let _ = crate::shell::warn(
"ignoring `consolidate-commits=false`; `cargo release commit` can effectively only do one commit",
);
}
super::commit::workspace_commit(&ws_meta, &ws_config, &selected_pkgs, dry_run)?;
} else if !selected_pkgs.is_empty() {
let selected_pkg = selected_pkgs
.first()
.expect("non-workspace can have at most 1 package");
super::commit::pkg_commit(selected_pkg, dry_run)?;
}

super::finish(failed, dry_run)
}
Expand Down

0 comments on commit e05ddbe

Please sign in to comment.