cli git init: show jj bookmark track command on new line

I often copy and run this command after running `jj git init --colocate`. Having it on a
separate line makes it stand out more and easier to copy, especially if there are many
bookmarks listed.
This commit is contained in:
Vincent Ging Ho Yim 2025-05-13 17:07:59 +10:00
parent 3cb6c8def3
commit e0bd530686
2 changed files with 9 additions and 4 deletions

View File

@ -19,6 +19,7 @@ use std::path::PathBuf;
use std::str;
use std::sync::Arc;
use indoc::writedoc;
use itertools::Itertools as _;
use jj_lib::file_util;
use jj_lib::git;
@ -279,10 +280,13 @@ fn print_trackable_remote_bookmarks(ui: &Ui, view: &View) -> io::Result<()> {
write!(formatter, " ")?;
writeln!(formatter.labeled("bookmark"), "{symbol}")?;
}
writeln!(
writedoc!(
formatter.labeled("hint").with_heading("Hint: "),
"Run `jj bookmark track {syms}` to keep local bookmarks updated on future pulls.",
syms = remote_bookmark_symbols.iter().join(" "),
"
Run the following command to keep local bookmarks updated on future pulls:
jj bookmark track {syms}
",
syms = remote_bookmark_symbols.iter().join(" ")
)?;
}
Ok(())

View File

@ -582,7 +582,8 @@ fn test_git_init_colocated_via_git_repo_path_imported_refs() {
Done importing changes from the underlying Git repo.
Hint: The following remote bookmarks aren't associated with the existing local bookmarks:
local-remote@origin
Hint: Run `jj bookmark track local-remote@origin` to keep local bookmarks updated on future pulls.
Hint: Run the following command to keep local bookmarks updated on future pulls:
jj bookmark track local-remote@origin
Initialized repo in "."
[EOF]
"#);