Thanks to visit codestin.com
Credit goes to github.com

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
1 change: 1 addition & 0 deletions src/default_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ commit_menu.--reset-author = ["-R"]
commit_menu.--signoff = ["-s"]
commit_menu.commit = ["c"]
commit_menu.commit_amend = ["a"]
commit_menu.commit_extend = ["e"]
commit_menu.commit_fixup = ["f"]
commit_menu.commit_instant_fixup = ["F"]
commit_menu.quit = ["q", "<esc>"]
Expand Down
19 changes: 19 additions & 0 deletions src/ops/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@
}
}

pub(crate) struct CommitExtend;
impl OpTrait for CommitExtend {
fn get_action(&self, _target: Option<&TargetData>) -> Option<Action> {
Some(Rc::new(|app: &mut App, term: &mut Term| {
let mut cmd = Command::new("git");
cmd.args(["commit", "--amend", "--no-edit"]);
cmd.args(app.state.pending_menu.as_ref().unwrap().args());

app.close_menu();
app.run_cmd_interactive(term, cmd)?;
Ok(())
}))
}

Check warning on line 81 in src/ops/commit.rs

View check run for this annotation

Codecov / codecov/patch

src/ops/commit.rs#L71-L81

Added lines #L71 - L81 were not covered by tests

fn display(&self, _state: &State) -> String {
"extend".into()
}
}

pub(crate) struct CommitFixup;
impl OpTrait for CommitFixup {
fn get_action(&self, target: Option<&TargetData>) -> Option<Action> {
Expand Down
2 changes: 2 additions & 0 deletions src/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub(crate) enum Op {
Delete,
Commit,
CommitAmend,
CommitExtend,
FetchAll,
FetchElsewhere,
LogCurrent,
Expand Down Expand Up @@ -135,6 +136,7 @@ impl Op {
Op::Delete => Box::new(branch::Delete),
Op::Commit => Box::new(commit::Commit),
Op::CommitAmend => Box::new(commit::CommitAmend),
Op::CommitExtend => Box::new(commit::CommitExtend),
Op::FetchAll => Box::new(fetch::FetchAll),
Op::FetchElsewhere => Box::new(fetch::FetchElsewhere),
Op::LogCurrent => Box::new(log::LogCurrent),
Expand Down
Loading