diff --git a/src/commands/branch.rs b/src/commands/branch.rs index 138d7c8fdf..a55f86ab0f 100644 --- a/src/commands/branch.rs +++ b/src/commands/branch.rs @@ -360,6 +360,13 @@ fn cmd_branch_list( } } print_branch_target(formatter, Some(remote_target))?; + if remote != "git" && branch_target.local_target.is_none() { + writeln!( + formatter, + " (will be *deleted permanently* on the remote on the next `jj git push`. \ + Use `jj branch forget` to prevent this)" + )?; + } } } diff --git a/tests/test_branch_command.rs b/tests/test_branch_command.rs index ff7306aa09..5c2cabaea8 100644 --- a/tests/test_branch_command.rs +++ b/tests/test_branch_command.rs @@ -310,6 +310,7 @@ fn test_branch_forget_deleted_or_nonexistent_branch() { insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###" feature1 (deleted) @origin: 9f01a0e04879 message + (will be *deleted permanently* on the remote on the next `jj git push`. Use `jj branch forget` to prevent this) "###); // ============ End of test setup ============ diff --git a/tests/test_git_fetch.rs b/tests/test_git_fetch.rs index 083d8bbb29..addc3fb6e9 100644 --- a/tests/test_git_fetch.rs +++ b/tests/test_git_fetch.rs @@ -949,5 +949,6 @@ fn test_git_fetch_remote_only_branch() { feature1: 9f01a0e04879 message feature2 (deleted) @origin: 9f01a0e04879 message + (will be *deleted permanently* on the remote on the next `jj git push`. Use `jj branch forget` to prevent this) "###); } diff --git a/tests/test_git_push.rs b/tests/test_git_push.rs index 441b5b8b74..6ac3131f08 100644 --- a/tests/test_git_push.rs +++ b/tests/test_git_push.rs @@ -184,6 +184,7 @@ fn test_git_push_multiple() { insta::assert_snapshot!(stdout, @r###" branch1 (deleted) @origin: 45a3aa29e907 description 1 + (will be *deleted permanently* on the remote on the next `jj git push`. Use `jj branch forget` to prevent this) branch2: 15dcdaa4f12f foo @origin (ahead by 1 commits, behind by 1 commits): 8476341eb395 description 2 my-branch: 15dcdaa4f12f foo