forked from mirrors/jj
cli: rephrase @git branch with no local counterpart as "deleted"
Since forgotten branches are now removed at all, the only situation where @git branch persists is that the branch got removed but is not exported yet.
This commit is contained in:
parent
28e5ee35aa
commit
1eb8b95a6c
2 changed files with 25 additions and 3 deletions
|
@ -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() {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue