mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-28 17:41:14 +00:00
cli: add hint for git-exporting forgotten branches
Inspired by d01ecc5c46
"more detailed message describing deleted branches."
And yes, "jj git export" does propagate "jj branch forget" to the underlying
Git repository, which strengthen my feeling that git::export_refs() should
also remove "forgotten" remote tracking refs.
This commit is contained in:
parent
72792a8dbe
commit
3c2657c393
2 changed files with 16 additions and 6 deletions
|
@ -369,12 +369,21 @@ fn cmd_branch_list(
|
|||
}
|
||||
print_branch_target(formatter, remote_target)?;
|
||||
}
|
||||
if found_non_git_remote && branch_target.local_target.is_none() {
|
||||
writeln!(
|
||||
formatter,
|
||||
" (this branch will be *deleted permanently* on the remote on the\n next `jj \
|
||||
git push`. Use `jj branch forget` to prevent this)"
|
||||
)?;
|
||||
|
||||
if branch_target.local_target.is_none() {
|
||||
if found_non_git_remote {
|
||||
writeln!(
|
||||
formatter,
|
||||
" (this branch will be *deleted permanently* on the remote on the\n next \
|
||||
`jj git push`. Use `jj branch forget` to prevent this)"
|
||||
)?;
|
||||
} else {
|
||||
writeln!(
|
||||
formatter,
|
||||
" (this branch will be deleted from the underlying Git repo on the next `jj \
|
||||
git export`)"
|
||||
)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ fn test_branch_forget_export() {
|
|||
insta::assert_snapshot!(stdout, @r###"
|
||||
foo (forgotten)
|
||||
@git: 65b6b74e0897 (no description set)
|
||||
(this branch will be deleted from the underlying Git repo on the next `jj git export`)
|
||||
"###);
|
||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r=foo", "--no-graph"]);
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
|
|
Loading…
Reference in a new issue