cli: use "hint" style for hint about using --git-repo=.

This commit is contained in:
Martin von Zweigbergk 2022-11-12 15:41:28 -08:00 committed by Martin von Zweigbergk
parent 7ce8138794
commit 92f6571b31
2 changed files with 6 additions and 4 deletions

View file

@ -1100,9 +1100,10 @@ Set `ui.allow-init-native` to allow initializing a repo with the native backend.
let relative_wc_path = file_util::relative_path(&cwd, &wc_path);
writeln!(ui, "Initialized repo in \"{}\"", relative_wc_path.display())?;
if args.git && wc_path.join(".git").exists() {
ui.write_warn(format!(
"Empty repo created. To create repo backed by existing Git repo, run `jj init \
--git-repo={}` instead.\n",
ui.write_warn("Empty repo created.\n")?;
ui.write_hint(format!(
"Hint: To create a repo backed by the existing Git repo, run `jj init --git-repo={}` \
instead.\n",
relative_wc_path.display()
))?;
}

View file

@ -169,7 +169,8 @@ fn test_init_git_internal_but_could_be_colocated() {
Initialized repo in "."
"###);
insta::assert_snapshot!(get_stderr_string(&assert), @r###"
Empty repo created. To create repo backed by existing Git repo, run `jj init --git-repo=.` instead.
Empty repo created.
Hint: To create a repo backed by the existing Git repo, run `jj init --git-repo=.` instead.
"###);
}