diff --git a/cli/src/commands/branch.rs b/cli/src/commands/branch.rs index 2ddbf8b3f2..d73e0d1da0 100644 --- a/cli/src/commands/branch.rs +++ b/cli/src/commands/branch.rs @@ -403,10 +403,8 @@ fn cmd_branch_list( write!(formatter.labeled("branch"), "{name}")?; if branch_target.local_target.is_present() { print_branch_target(formatter, &branch_target.local_target)?; - } else if found_non_git_remote { - writeln!(formatter, " (deleted)")?; } else { - writeln!(formatter, " (forgotten)")?; + writeln!(formatter, " (deleted)")?; } for (remote, remote_target) in branch_target.remote_targets.iter() { diff --git a/cli/tests/test_branch_command.rs b/cli/tests/test_branch_command.rs index da939cbe8b..f0e7c0b507 100644 --- a/cli/tests/test_branch_command.rs +++ b/cli/tests/test_branch_command.rs @@ -221,6 +221,30 @@ fn test_branch_delete_glob() { "###); } +#[test] +fn test_branch_delete_export() { + let test_env = TestEnvironment::default(); + test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]); + let repo_path = test_env.env_root().join("repo"); + + test_env.jj_cmd_success(&repo_path, &["new"]); + test_env.jj_cmd_success(&repo_path, &["branch", "set", "foo"]); + test_env.jj_cmd_success(&repo_path, &["git", "export"]); + + test_env.jj_cmd_success(&repo_path, &["branch", "delete", "foo"]); + let stdout = test_env.jj_cmd_success(&repo_path, &["branch", "list"]); + insta::assert_snapshot!(stdout, @r###" + foo (deleted) + @git: rlvkpnrz 65b6b74e (empty) (no description set) + (this branch will be deleted from the underlying Git repo on the next `jj git export`) + "###); + + test_env.jj_cmd_success(&repo_path, &["git", "export"]); + let stdout = test_env.jj_cmd_success(&repo_path, &["branch", "list"]); + insta::assert_snapshot!(stdout, @r###" + "###); +} + #[test] fn test_branch_forget_export() { let test_env = TestEnvironment::default();