Skip to content

Commit 07cf88b

Browse files
committed
fix: remove CheckoutOptions::KeepLocalChanges
1 parent 61f0019 commit 07cf88b

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

src/popups/checkout_option.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use anyhow::{Ok, Result};
1616
use asyncgit::sync::branch::checkout_remote_branch;
1717
use asyncgit::sync::status::discard_status;
1818
use asyncgit::sync::{
19-
checkout_branch, stash_pop, stash_save, BranchInfo, RepoPath,
19+
checkout_branch, BranchInfo, RepoPath,
2020
};
2121
use crossterm::event::Event;
2222
use ratatui::{
@@ -43,7 +43,7 @@ impl CheckoutOptionPopup {
4343
queue: env.queue.clone(),
4444
repo: env.repo.borrow().clone(),
4545
branch: None,
46-
option: CheckoutOptions::KeepLocalChanges,
46+
option: CheckoutOptions::Unchange,
4747
visible: false,
4848
key_config: env.key_config.clone(),
4949
theme: env.theme.clone(),
@@ -107,12 +107,6 @@ impl CheckoutOptionPopup {
107107

108108
fn handle_event(&mut self) -> Result<()> {
109109
match self.option {
110-
CheckoutOptions::KeepLocalChanges => {
111-
let stash_id =
112-
stash_save(&self.repo, None, true, false)?;
113-
self.checkout()?;
114-
stash_pop(&self.repo, stash_id)?;
115-
}
116110
CheckoutOptions::Unchange => {
117111
self.checkout()?;
118112
}

src/strings.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -440,43 +440,34 @@ pub fn ellipsis_trim_start(s: &str, width: usize) -> Cow<'_, str> {
440440

441441
#[derive(PartialEq, Eq, Clone, Copy)]
442442
pub enum CheckoutOptions {
443-
KeepLocalChanges,
444443
Unchange,
445444
Discard,
446445
}
447446

448447
impl CheckoutOptions {
449448
pub const fn previous(self) -> Self {
450449
match self {
451-
Self::KeepLocalChanges => Self::Discard,
452-
Self::Unchange => Self::KeepLocalChanges,
450+
Self::Unchange => Self::Discard,
453451
Self::Discard => Self::Unchange,
454452
}
455453
}
456454

457455
pub const fn next(self) -> Self {
458456
match self {
459-
Self::KeepLocalChanges => Self::Unchange,
460457
Self::Unchange => Self::Discard,
461-
Self::Discard => Self::KeepLocalChanges,
458+
Self::Discard => Self::Unchange,
462459
}
463460
}
464461

465462
pub const fn to_string_pair(
466463
self,
467464
) -> (&'static str, &'static str) {
468-
const CHECKOUT_OPTION_STASH_AND_REAPPLY: &str =
469-
" 🟢 Stash and reapply changes";
470465
const CHECKOUT_OPTION_UNCHANGE: &str =
471466
" 🟡 Keep local changes";
472467
const CHECKOUT_OPTION_DISCARD: &str =
473468
" 🔴 Discard all local changes";
474469

475470
match self {
476-
Self::KeepLocalChanges => (
477-
"Stash and reapply",
478-
CHECKOUT_OPTION_STASH_AND_REAPPLY,
479-
),
480471
Self::Unchange => {
481472
("Don't change", CHECKOUT_OPTION_UNCHANGE)
482473
}

0 commit comments

Comments
 (0)