Skip to content

Commit 3b63920

Browse files
authored
fix: Actually use squash mode when asked to. (#19)
1 parent 73092be commit 3b63920

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ enum Changes {
1313
}
1414

1515
pub fn instafix(
16-
_squash: bool,
16+
squash: bool,
1717
max_commits: usize,
1818
message_pattern: Option<String>,
1919
upstream_branch_name: Option<&str>,
@@ -26,7 +26,7 @@ pub fn instafix(
2626
let upstream = get_upstream(&repo, &head_branch, upstream_branch_name)?;
2727
let commit_to_amend = select_commit_to_amend(&repo, upstream, max_commits, &message_pattern)?;
2828
eprintln!("Selected {}", disp(&commit_to_amend));
29-
do_fixup_commit(&repo, &head_branch, &commit_to_amend, false)?;
29+
do_fixup_commit(&repo, &head_branch, &commit_to_amend, squash)?;
3030
let current_branch = Branch::wrap(repo.head()?);
3131
do_rebase(&repo, &current_branch, &commit_to_amend, &diff)?;
3232

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ When run with no arguments this will:
3838
max_term_width = 100
3939
)]
4040
struct Args {
41-
/// Use `squash!`: change the commit message that you amend
41+
/// Change the commit message that you amend, instead of using the original commit message
4242
#[clap(short = 's', long = "squash")]
4343
squash: bool,
4444
/// The maximum number of commits to show when looking for your merge point
@@ -59,6 +59,7 @@ struct Args {
5959

6060
fn main() {
6161
let mut args = Args::parse();
62+
// if called as git squash set the squash flag to true
6263
if env::args().next().unwrap().ends_with("squash") {
6364
args.squash = true
6465
}

0 commit comments

Comments
 (0)