diff --git a/src/app.rs b/src/app.rs index 8a6cdc7704..2f96301efa 100644 --- a/src/app.rs +++ b/src/app.rs @@ -654,7 +654,6 @@ impl App { /// } /// } /// ``` - #[allow(dead_code)] pub fn picker( &mut self, term: &mut Term, diff --git a/src/ops/branch.rs b/src/ops/branch.rs index 825234982d..55ec95ab70 100644 --- a/src/ops/branch.rs +++ b/src/ops/branch.rs @@ -9,6 +9,7 @@ use crate::{ }, item_data::{ItemData, RefKind}, menu::arg::Arg, + picker::{PickerData, PickerItem, PickerState}, term::Term, }; use std::{process::Command, rc::Rc}; @@ -21,16 +22,15 @@ pub(crate) struct Checkout; impl OpTrait for Checkout { fn get_action(&self, _target: &ItemData) -> Option { Some(Rc::new(move |app: &mut App, term: &mut Term| { - let rev = app.prompt( - term, - &PromptParams { - prompt: "Checkout", - create_default_value: Box::new(selected_rev), - ..Default::default() - }, - )?; + let picker = create_branch_picker(app, "Checkout", true)?; + app.close_menu(); + let result = app.picker(term, picker)?; + + if let Some(data) = result { + let rev = data.display(); + checkout(app, term, rev)?; + } - checkout(app, term, &rev)?; Ok(()) })) } @@ -44,7 +44,6 @@ fn checkout(app: &mut App, term: &mut Term, rev: &str) -> Res<()> { let mut cmd = Command::new("git"); cmd.args(["checkout", rev]); - app.close_menu(); app.run_cmd(term, &[], cmd)?; Ok(()) } @@ -93,17 +92,15 @@ impl OpTrait for Delete { Some(Rc::new(move |app: &mut App, term: &mut Term| { let default = default.clone(); + let picker = create_branch_picker_with_default(app, "Delete", true, default)?; + app.close_menu(); + let result = app.picker(term, picker)?; - let branch_name = app.prompt( - term, - &PromptParams { - prompt: "Delete", - create_default_value: Box::new(move |_| default.clone()), - ..Default::default() - }, - )?; + if let Some(data) = result { + let branch_name = data.display(); + delete(app, term, branch_name)?; + } - delete(app, term, &branch_name)?; Ok(()) })) } @@ -132,7 +129,6 @@ pub fn delete(app: &mut App, term: &mut Term, branch_name: &str) -> Res<()> { cmd.arg(branch_name); - app.close_menu(); app.run_cmd(term, &[], cmd)?; Ok(()) } @@ -226,3 +222,107 @@ impl OpTrait for Spinoff { "Spinoff branch".into() } } + +fn create_branch_picker( + app: &App, + prompt: &'static str, + exclude_current: bool, +) -> Result { + create_branch_picker_with_default(app, prompt, exclude_current, selected_rev(app)) +} + +fn create_branch_picker_with_default( + app: &App, + prompt: &'static str, + exclude_current: bool, + default_rev: Option, +) -> Result { + let mut items = Vec::new(); + let mut seen = std::collections::HashSet::new(); + + // Get current branch name if we need to exclude it + let current_branch = if exclude_current { + app.state + .repo + .head() + .ok() + .and_then(|head| head.shorthand().map(|s| s.to_string())) + } else { + None + }; + + // Add default value first if it exists and is not current branch + if let Some(ref default) = default_rev + && Some(default.as_str()) != current_branch.as_deref() + { + items.push(PickerItem::new( + default.clone(), + PickerData::Revision(default.clone()), + )); + seen.insert(default.clone()); + } + + // Get all branches (exclude current if needed) + let branches = app + .state + .repo + .branches(None) + .map_err(Error::ListGitReferences)?; + for branch in branches { + let (branch, _) = branch.map_err(Error::ListGitReferences)?; + if let Some(name) = branch.name().map_err(Error::ListGitReferences)? { + let name = name.to_string(); + // Skip current branch and already seen names + if Some(&name) != current_branch.as_ref() && !seen.contains(&name) { + items.push(PickerItem::new( + name.clone(), + PickerData::Revision(name.clone()), + )); + seen.insert(name); + } + } + } + + // Get all tags + let tag_names = app + .state + .repo + .tag_names(None) + .map_err(Error::ListGitReferences)?; + for tag_name in tag_names.iter().flatten() { + let tag_name = tag_name.to_string(); + if !seen.contains(&tag_name) { + items.push(PickerItem::new( + tag_name.clone(), + PickerData::Revision(tag_name.clone()), + )); + seen.insert(tag_name); + } + } + + // Get all remote branches + let references = app + .state + .repo + .references() + .map_err(Error::ListGitReferences)?; + for reference in references { + let reference = reference.map_err(Error::ListGitReferences)?; + if reference.is_remote() + && let Some(name) = reference.shorthand() + { + let name = name.to_string(); + if !seen.contains(&name) { + items.push(PickerItem::new( + name.clone(), + PickerData::Revision(name.clone()), + )); + seen.insert(name); + } + } + } + + // Allow custom input to support commit hashes, relative refs (e.g., HEAD~3), + // and other git revisions not in the predefined list + Ok(PickerState::new(prompt, items, true)) +} diff --git a/src/tests/branch.rs b/src/tests/branch.rs index ce189cf4d1..49e8e291b3 100644 --- a/src/tests/branch.rs +++ b/src/tests/branch.rs @@ -1,57 +1,93 @@ use super::*; -fn setup(ctx: TestContext) -> TestContext { - run(&ctx.dir, &["git", "checkout", "-b", "merged"]); - run(&ctx.dir, &["git", "checkout", "-b", "unmerged"]); - commit(&ctx.dir, "first commit", ""); +fn setup_picker(ctx: TestContext) -> TestContext { + // Create multiple branches and tags for comprehensive testing + run(&ctx.dir, &["git", "checkout", "-b", "feature-a"]); + commit(&ctx.dir, "feature-a commit", ""); + run(&ctx.dir, &["git", "checkout", "main"]); + + run(&ctx.dir, &["git", "checkout", "-b", "feature-b"]); + commit(&ctx.dir, "feature-b commit", ""); run(&ctx.dir, &["git", "checkout", "main"]); + + run(&ctx.dir, &["git", "checkout", "-b", "bugfix-123"]); + commit(&ctx.dir, "bugfix commit", ""); + run(&ctx.dir, &["git", "checkout", "main"]); + + // Create some tags + run(&ctx.dir, &["git", "tag", "v1.0.0"]); + run(&ctx.dir, &["git", "tag", "v2.0.0"]); + ctx } +// ==================== Checkout Tests ==================== + #[test] -fn branch_menu() { - snapshot!(setup(setup_clone!()), "Yjb"); +fn checkout_picker() { + snapshot!(setup_picker(setup_clone!()), "bb"); } #[test] -fn switch_branch_selected() { - snapshot!(setup(setup_clone!()), "Yjjbb"); +fn checkout_picker_cancel() { + snapshot!(setup_picker(setup_clone!()), "bb"); } #[test] -fn switch_branch_input() { - snapshot!(setup(setup_clone!()), "Ybbmerged"); +fn checkout_select_from_list() { + snapshot!(setup_picker(setup_clone!()), "bbfeature-a"); } #[test] -fn checkout_new_branch() { - snapshot!(setup(setup_clone!()), "bcnew"); +fn checkout_use_custom_input() { + let ctx = setup_picker(setup_clone!()); + // Get the commit hash of the first commit + let output = run(&ctx.dir, &["git", "rev-parse", "HEAD"]); + let commit_hash = output.trim(); + + snapshot!(ctx, &format!("bb{}", commit_hash)); +} + +// ==================== Delete Tests ==================== + +#[test] +fn delete_picker() { + snapshot!(setup_picker(setup_clone!()), "bK"); } #[test] -fn delete_branch_selected() { - snapshot!(setup(setup_clone!()), "YjjbK"); +fn delete_picker_cancel() { + snapshot!(setup_picker(setup_clone!()), "bK"); } #[test] -fn delete_branch_input() { - snapshot!(setup(setup_clone!()), "bKmerged"); +fn delete_select_from_list() { + snapshot!(setup_picker(setup_clone!()), "bKfeature-a"); } #[test] -fn delete_branch_empty() { - snapshot!(setup(setup_clone!()), "bK"); +fn delete_use_custom_input() { + snapshot!(setup_picker(setup_clone!()), "bKfeature-b"); } #[test] fn delete_unmerged_branch() { - let ctx = setup(setup_clone!()); - snapshot!(ctx, "bKunmergednbKunmergedy"); + let ctx = setup_picker(setup_clone!()); + snapshot!(ctx, "bKbugfix-123nbKbugfix-123y"); } +// ==================== CheckoutNewBranch Tests ==================== + +#[test] +fn checkout_new_branch() { + snapshot!(setup_clone!(), "bcnew"); +} + +// ==================== Spinoff Tests ==================== + #[test] fn spinoff_branch() { - snapshot!(setup(setup_clone!()), "bsnew"); + snapshot!(setup_picker(setup_clone!()), "bsnew"); } #[test] @@ -64,5 +100,12 @@ fn spinoff_branch_with_unmerged_commits() { #[test] fn spinoff_existing_branch() { - snapshot!(setup(setup_clone!()), "bsunmerged"); + snapshot!(setup_picker(setup_clone!()), "bsfeature-a"); +} + +// ==================== Branch Menu Test ==================== + +#[test] +fn branch_menu() { + snapshot!(setup_picker(setup_clone!()), "b"); } diff --git a/src/tests/editor.rs b/src/tests/editor.rs index 062eccf594..7481df8d6d 100644 --- a/src/tests/editor.rs +++ b/src/tests/editor.rs @@ -56,11 +56,11 @@ fn move_next_then_parent_section() { } #[test] -fn exit_from_prompt_exits_menu() { +fn exit_from_picker_exits_menu() { snapshot!(setup_clone!(), "bb"); } #[test] -fn re_enter_prompt_from_menu() { +fn re_enter_picker_from_menu() { snapshot!(setup_clone!(), "bbbb"); } diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 1292f5dd6f..ecacce3719 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -218,47 +218,6 @@ fn merge_conflict() { insta::assert_snapshot!(ctx.redact_buffer()); } -#[test] -fn revert_conflict() { - let mut ctx = setup_clone!(); - commit(&ctx.dir, "new-file", "hey"); - commit(&ctx.dir, "new-file", "hi"); - - run_ignore_status(&ctx.dir, &["git", "revert", "HEAD~1"]); - - ctx.init_app(); - insta::assert_snapshot!(ctx.redact_buffer()); -} - -#[test] -fn revert_abort() { - let ctx = setup_clone!(); - commit(&ctx.dir, "new-file", "hey"); - commit(&ctx.dir, "new-file", "hi"); - - run_ignore_status(&ctx.dir, &["git", "revert", "HEAD~1"]); - - snapshot!(ctx, "Va"); -} - -#[test] -fn revert_menu() { - let ctx = setup_clone!(); - snapshot!(ctx, "llV"); -} - -#[test] -fn revert_commit_prompt() { - let ctx = setup_clone!(); - snapshot!(ctx, "llVV"); -} - -#[test] -fn revert_commit() { - let ctx = setup_clone!(); - snapshot!(ctx, "llV-EV"); -} - #[test] fn moved_file() { let mut ctx = setup_clone!(); diff --git a/src/tests/snapshots/gitu__tests__branch__branch_menu.snap b/src/tests/snapshots/gitu__tests__branch__branch_menu.snap index c93124f43b..b80bd4ebf0 100644 --- a/src/tests/snapshots/gitu__tests__branch__branch_menu.snap +++ b/src/tests/snapshots/gitu__tests__branch__branch_menu.snap @@ -2,14 +2,14 @@ source: src/tests/branch.rs expression: ctx.redact_buffer() --- - Branches | -▌* main | - merged | - unmerged | +▌On branch main | +▌Your branch is up to date with 'origin/main'. | + | + Recent commits | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | + | + | | - Remote origin | - origin/HEAD | - origin/main | | | | @@ -22,4 +22,4 @@ expression: ctx.redact_buffer() s Spinoff branch | K Delete branch | q/esc Quit/Close | -styles_hash: a06534dee707ba43 +styles_hash: 2b3559858c649dec diff --git a/src/tests/snapshots/gitu__tests__branch__checkout_new_branch.snap b/src/tests/snapshots/gitu__tests__branch__checkout_new_branch.snap index 3b0cc6f1ef..4cd551344b 100644 --- a/src/tests/snapshots/gitu__tests__branch__checkout_new_branch.snap +++ b/src/tests/snapshots/gitu__tests__branch__checkout_new_branch.snap @@ -5,7 +5,7 @@ expression: ctx.redact_buffer() ▌On branch new | | Recent commits | - b66a0bf main merged new origin/main add initial-file | + b66a0bf main new origin/main add initial-file | | | | @@ -22,4 +22,4 @@ expression: ctx.redact_buffer() ────────────────────────────────────────────────────────────────────────────────| $ git checkout -b new | Switched to a new branch 'new' | -styles_hash: 2afc72138214b087 +styles_hash: fc716abcbd3de04a diff --git a/src/tests/snapshots/gitu__tests__branch__checkout_picker.snap b/src/tests/snapshots/gitu__tests__branch__checkout_picker.snap new file mode 100644 index 0000000000..369e53aa82 --- /dev/null +++ b/src/tests/snapshots/gitu__tests__branch__checkout_picker.snap @@ -0,0 +1,25 @@ +--- +source: src/tests/branch.rs +expression: ctx.redact_buffer() +--- + On branch main | + Your branch is up to date with 'origin/main'. | + | + Recent commits | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | + | + | + | +────────────────────────────────────────────────────────────────────────────────| + 7/7 Checkout › █ | +▌bugfix-123 | + feature-a | + feature-b | + origin/HEAD | + origin/main | + v1.0.0 | + v2.0.0 | + | + | + | +styles_hash: d0729ae36786267b diff --git a/src/tests/snapshots/gitu__tests__revert_commit.snap b/src/tests/snapshots/gitu__tests__branch__checkout_picker_cancel.snap similarity index 73% rename from src/tests/snapshots/gitu__tests__revert_commit.snap rename to src/tests/snapshots/gitu__tests__branch__checkout_picker_cancel.snap index e316f3b71c..fe93e837d7 100644 --- a/src/tests/snapshots/gitu__tests__revert_commit.snap +++ b/src/tests/snapshots/gitu__tests__branch__checkout_picker_cancel.snap @@ -1,10 +1,12 @@ --- -source: src/tests/mod.rs +source: src/tests/branch.rs expression: ctx.redact_buffer() --- -▌6324471 main Revert "add initial-file" | - b66a0bf origin/main add initial-file | +▌On branch main | +▌Your branch is up to date with 'origin/main'. | | + Recent commits | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | | | | @@ -20,6 +22,4 @@ expression: ctx.redact_buffer() | | | -────────────────────────────────────────────────────────────────────────────────| -$ git revert --edit --no-edit b66a0bf82020d6a386e94d0fceedec1f817d20c7 | -styles_hash: 6dd7ad347925516e +styles_hash: 5ea219649635416a diff --git a/src/tests/snapshots/gitu__tests__branch__delete_branch_input.snap b/src/tests/snapshots/gitu__tests__branch__checkout_select_from_list.snap similarity index 80% rename from src/tests/snapshots/gitu__tests__branch__delete_branch_input.snap rename to src/tests/snapshots/gitu__tests__branch__checkout_select_from_list.snap index 10ec0d736e..44d0c8a5a5 100644 --- a/src/tests/snapshots/gitu__tests__branch__delete_branch_input.snap +++ b/src/tests/snapshots/gitu__tests__branch__checkout_select_from_list.snap @@ -2,11 +2,11 @@ source: src/tests/branch.rs expression: ctx.redact_buffer() --- -▌On branch main | -▌Your branch is up to date with 'origin/main'. | +▌On branch feature-a | | Recent commits | - b66a0bf main origin/main add initial-file | + 3b23a7d feature-a add feature-a commit | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | | | | @@ -20,6 +20,6 @@ expression: ctx.redact_buffer() | | ────────────────────────────────────────────────────────────────────────────────| -$ git branch -d merged | -Deleted branch merged (was b66a0bf). | -styles_hash: dce6312dfc6aa477 +$ git checkout feature-a | +Switched to branch 'feature-a' | +styles_hash: ed07bb3ef72d6e56 diff --git a/src/tests/snapshots/gitu__tests__branch__checkout_use_custom_input.snap b/src/tests/snapshots/gitu__tests__branch__checkout_use_custom_input.snap new file mode 100644 index 0000000000..d502f11baf --- /dev/null +++ b/src/tests/snapshots/gitu__tests__branch__checkout_use_custom_input.snap @@ -0,0 +1,25 @@ +--- +source: src/tests/branch.rs +expression: ctx.redact_buffer() +--- +▌No branch | + | + Recent commits | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | + | + | + | +────────────────────────────────────────────────────────────────────────────────| +$ git checkout b66a0bf82020d6a386e94d0fceedec1f817d20c7 | +Note: switching to 'b66a0bf82020d6a386e94d0fceedec1f817d20c7'. | +You are in 'detached HEAD' state. You can look around, make experimental | +changes and commit them, and you can discard any commits you make in this | +state without impacting any branches by switching back to a branch. | +If you want to create a new branch to retain commits you create, you may | +do so (now or later) by using -c with the switch command. Example: | + git switch -c | +Or undo this operation with: | + git switch - | +Turn off this advice by setting config variable advice.detachedHead to false | +HEAD is now at b66a0bf add initial-file | +styles_hash: cfd01b18ca92dee4 diff --git a/src/tests/snapshots/gitu__tests__branch__delete_branch_selected.snap b/src/tests/snapshots/gitu__tests__branch__delete_branch_selected.snap deleted file mode 100644 index 72017301f8..0000000000 --- a/src/tests/snapshots/gitu__tests__branch__delete_branch_selected.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: src/tests/branch.rs -expression: ctx.redact_buffer() ---- - Branches | - * main | -▌ unmerged | - | - Remote origin | - origin/HEAD | - origin/main | - | - | - | - | - | - | - | - | - | - | -────────────────────────────────────────────────────────────────────────────────| -$ git branch -d merged | -Deleted branch merged (was b66a0bf). | -styles_hash: dd0c306c9b4c03e8 diff --git a/src/tests/snapshots/gitu__tests__branch__delete_picker.snap b/src/tests/snapshots/gitu__tests__branch__delete_picker.snap new file mode 100644 index 0000000000..fd5eea07dd --- /dev/null +++ b/src/tests/snapshots/gitu__tests__branch__delete_picker.snap @@ -0,0 +1,25 @@ +--- +source: src/tests/branch.rs +expression: ctx.redact_buffer() +--- + On branch main | + Your branch is up to date with 'origin/main'. | + | + Recent commits | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | + | + | + | +────────────────────────────────────────────────────────────────────────────────| + 7/7 Delete › █ | +▌bugfix-123 | + feature-a | + feature-b | + origin/HEAD | + origin/main | + v1.0.0 | + v2.0.0 | + | + | + | +styles_hash: 6a255f9ee8d30c59 diff --git a/src/tests/snapshots/gitu__tests__branch__delete_picker_cancel.snap b/src/tests/snapshots/gitu__tests__branch__delete_picker_cancel.snap new file mode 100644 index 0000000000..fe93e837d7 --- /dev/null +++ b/src/tests/snapshots/gitu__tests__branch__delete_picker_cancel.snap @@ -0,0 +1,25 @@ +--- +source: src/tests/branch.rs +expression: ctx.redact_buffer() +--- +▌On branch main | +▌Your branch is up to date with 'origin/main'. | + | + Recent commits | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +styles_hash: 5ea219649635416a diff --git a/src/tests/snapshots/gitu__tests__branch__delete_branch_empty.snap b/src/tests/snapshots/gitu__tests__branch__delete_select_from_list.snap similarity index 90% rename from src/tests/snapshots/gitu__tests__branch__delete_branch_empty.snap rename to src/tests/snapshots/gitu__tests__branch__delete_select_from_list.snap index 5e19878d05..8711580f00 100644 --- a/src/tests/snapshots/gitu__tests__branch__delete_branch_empty.snap +++ b/src/tests/snapshots/gitu__tests__branch__delete_select_from_list.snap @@ -6,7 +6,7 @@ expression: ctx.redact_buffer() ▌Your branch is up to date with 'origin/main'. | | Recent commits | - b66a0bf main merged origin/main add initial-file | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | | | | @@ -21,5 +21,5 @@ expression: ctx.redact_buffer() | | ────────────────────────────────────────────────────────────────────────────────| -! Branch name required | -styles_hash: e1391c67392b2270 +? Branch is not fully merged. Really delete? (y or n) › █ | +styles_hash: 34185cd7d71d1f27 diff --git a/src/tests/snapshots/gitu__tests__branch__delete_unmerged_branch.snap b/src/tests/snapshots/gitu__tests__branch__delete_unmerged_branch.snap index 9bf5109dce..eab5a80e98 100644 --- a/src/tests/snapshots/gitu__tests__branch__delete_unmerged_branch.snap +++ b/src/tests/snapshots/gitu__tests__branch__delete_unmerged_branch.snap @@ -6,7 +6,7 @@ expression: ctx.redact_buffer() ▌Your branch is up to date with 'origin/main'. | | Recent commits | - b66a0bf main merged origin/main add initial-file | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | | | | @@ -20,6 +20,6 @@ expression: ctx.redact_buffer() | | ────────────────────────────────────────────────────────────────────────────────| -$ git branch -d -f unmerged | -Deleted branch unmerged (was c84f226). | -styles_hash: 50fae40f3cb39dd3 +$ git branch -d -f bugfix-123 | +Deleted branch bugfix-123 (was 33a8c4d). | +styles_hash: 86ceb55a114a2ae diff --git a/src/tests/snapshots/gitu__tests__editor__re_enter_prompt_from_menu.snap b/src/tests/snapshots/gitu__tests__branch__delete_use_custom_input.snap similarity index 90% rename from src/tests/snapshots/gitu__tests__editor__re_enter_prompt_from_menu.snap rename to src/tests/snapshots/gitu__tests__branch__delete_use_custom_input.snap index 225503bda1..8711580f00 100644 --- a/src/tests/snapshots/gitu__tests__editor__re_enter_prompt_from_menu.snap +++ b/src/tests/snapshots/gitu__tests__branch__delete_use_custom_input.snap @@ -1,12 +1,12 @@ --- -source: src/tests/editor.rs +source: src/tests/branch.rs expression: ctx.redact_buffer() --- ▌On branch main | ▌Your branch is up to date with 'origin/main'. | | Recent commits | - b66a0bf main origin/main add initial-file | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | | | | @@ -21,5 +21,5 @@ expression: ctx.redact_buffer() | | ────────────────────────────────────────────────────────────────────────────────| -? Checkout: › █ | -styles_hash: 43da189f53b3be3d +? Branch is not fully merged. Really delete? (y or n) › █ | +styles_hash: 34185cd7d71d1f27 diff --git a/src/tests/snapshots/gitu__tests__branch__spinoff_branch.snap b/src/tests/snapshots/gitu__tests__branch__spinoff_branch.snap index e6106037c4..674d904349 100644 --- a/src/tests/snapshots/gitu__tests__branch__spinoff_branch.snap +++ b/src/tests/snapshots/gitu__tests__branch__spinoff_branch.snap @@ -5,7 +5,7 @@ expression: ctx.redact_buffer() ▌On branch new | | Recent commits | - b66a0bf main merged new origin/main add initial-file | + b66a0bf main new v1.0.0 v2.0.0 origin/main add initial-file | | | | @@ -22,4 +22,4 @@ expression: ctx.redact_buffer() $ git checkout -b new | Switched to a new branch 'new' | > Branch main not changed | -styles_hash: f6b1f1b8641cb19a +styles_hash: 510f0d108f9759f2 diff --git a/src/tests/snapshots/gitu__tests__branch__spinoff_existing_branch.snap b/src/tests/snapshots/gitu__tests__branch__spinoff_existing_branch.snap index a5bcfdbb21..dbaca57824 100644 --- a/src/tests/snapshots/gitu__tests__branch__spinoff_existing_branch.snap +++ b/src/tests/snapshots/gitu__tests__branch__spinoff_existing_branch.snap @@ -6,7 +6,7 @@ expression: ctx.redact_buffer() ▌Your branch is up to date with 'origin/main'. | | Recent commits | - b66a0bf main merged origin/main add initial-file | + b66a0bf main v1.0.0 v2.0.0 origin/main add initial-file | | | | @@ -21,5 +21,5 @@ expression: ctx.redact_buffer() | | ────────────────────────────────────────────────────────────────────────────────| -! Cannot spin-off unmerged. It already exists | -styles_hash: bde5e651489b5245 +! Cannot spin-off feature-a. It already exists | +styles_hash: 67e9d103b840ee58 diff --git a/src/tests/snapshots/gitu__tests__branch__switch_branch_input.snap b/src/tests/snapshots/gitu__tests__branch__switch_branch_input.snap deleted file mode 100644 index 60d9238c34..0000000000 --- a/src/tests/snapshots/gitu__tests__branch__switch_branch_input.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: src/tests/branch.rs -expression: ctx.redact_buffer() ---- -▌Branches | -▌ main | -▌* merged | -▌ unmerged | - | - Remote origin | - origin/HEAD | - origin/main | - | - | - | - | - | - | - | - | - | -────────────────────────────────────────────────────────────────────────────────| -$ git checkout merged | -Switched to branch 'merged' | -styles_hash: f62456b7eae3080f diff --git a/src/tests/snapshots/gitu__tests__branch__switch_branch_selected.snap b/src/tests/snapshots/gitu__tests__branch__switch_branch_selected.snap deleted file mode 100644 index aceab54432..0000000000 --- a/src/tests/snapshots/gitu__tests__branch__switch_branch_selected.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: src/tests/branch.rs -expression: ctx.redact_buffer() ---- - Branches | - main | -▌* merged | - unmerged | - | - Remote origin | - origin/HEAD | - origin/main | - | - | - | - | - | - | - | - | - | -────────────────────────────────────────────────────────────────────────────────| -$ git checkout merged | -Switched to branch 'merged' | -styles_hash: c4b788b765812f1b diff --git a/src/tests/snapshots/gitu__tests__editor__exit_from_prompt_exits_menu.snap b/src/tests/snapshots/gitu__tests__editor__exit_from_picker_exits_menu.snap similarity index 100% rename from src/tests/snapshots/gitu__tests__editor__exit_from_prompt_exits_menu.snap rename to src/tests/snapshots/gitu__tests__editor__exit_from_picker_exits_menu.snap diff --git a/src/tests/snapshots/gitu__tests__revert_abort.snap b/src/tests/snapshots/gitu__tests__editor__re_enter_picker_from_menu.snap similarity index 75% rename from src/tests/snapshots/gitu__tests__revert_abort.snap rename to src/tests/snapshots/gitu__tests__editor__re_enter_picker_from_menu.snap index 57fc9a5110..eea969d927 100644 --- a/src/tests/snapshots/gitu__tests__revert_abort.snap +++ b/src/tests/snapshots/gitu__tests__editor__re_enter_picker_from_menu.snap @@ -1,17 +1,19 @@ --- -source: src/tests/mod.rs +source: src/tests/editor.rs expression: ctx.redact_buffer() --- -▌On branch main | -▌Your branch is ahead of 'origin/main' by 2 commit(s). | + On branch main | + Your branch is up to date with 'origin/main'. | | Recent commits | - 7294ba4 main modify new-file | - 57409cb add new-file | - b66a0bf origin/main add initial-file | + b66a0bf main origin/main add initial-file | | | | +────────────────────────────────────────────────────────────────────────────────| + 2/2 Checkout › █ | +▌origin/HEAD | + origin/main | | | | @@ -20,6 +22,4 @@ expression: ctx.redact_buffer() | | | -────────────────────────────────────────────────────────────────────────────────| -$ git revert --abort | -styles_hash: 8d5b31c704dbb728 +styles_hash: 49e995be810c0237 diff --git a/src/tests/snapshots/gitu__tests__revert_commit_prompt.snap b/src/tests/snapshots/gitu__tests__revert_commit_prompt.snap deleted file mode 100644 index 0b236c9536..0000000000 --- a/src/tests/snapshots/gitu__tests__revert_commit_prompt.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: src/tests/mod.rs -expression: ctx.redact_buffer() ---- -▌b66a0bf main origin/main add initial-file | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | -────────────────────────────────────────────────────────────────────────────────| -? Revert commit (default b66a0bf82020d6a386e94d0fceedec1f817d20c7): › █ | -styles_hash: eed2121b6c3c5b0f diff --git a/src/tests/snapshots/gitu__tests__revert_conflict.snap b/src/tests/snapshots/gitu__tests__revert_conflict.snap deleted file mode 100644 index 119b9cba60..0000000000 --- a/src/tests/snapshots/gitu__tests__revert_conflict.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: src/tests/mod.rs -expression: ctx.redact_buffer() ---- -▌Reverting 57409cb | - | - Unstaged changes (1) | - unmerged new-file… | - | - Staged changes (1) | - unmerged new-file… | - | - Recent commits | - 7294ba4 main modify new-file | - 57409cb add new-file | - b66a0bf origin/main add initial-file | - | - | - | - | - | - | - | - | -styles_hash: ce1bcac7e4255e31 diff --git a/src/tests/snapshots/gitu__tests__revert_menu.snap b/src/tests/snapshots/gitu__tests__revert_menu.snap deleted file mode 100644 index 60a36e955c..0000000000 --- a/src/tests/snapshots/gitu__tests__revert_menu.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: src/tests/mod.rs -expression: ctx.redact_buffer() ---- -▌b66a0bf main origin/main add initial-file | - | - | - | - | - | - | - | - | - | - | - | - | - | -────────────────────────────────────────────────────────────────────────────────| - Revert Arguments | - a Abort -e Edit commit message (--edit) | - c Continue -E Don't edit commit message (--no-edit) | - V Revert commit(s) -s Add Signed-off-by lines (--signoff) | - q/esc Quit/Close | -styles_hash: 64dda6a1259ae722