-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: warn when workspace/.git exists, but is not colocated
We will be glad to have added this when people are using worktrees and breaking them, as worktrees are a bit more sensitive to things like moving the repo around on disk.
- Loading branch information
1 parent
fdd7775
commit 3fb42d3
Showing
5 changed files
with
105 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -470,26 +470,33 @@ fn test_init_git_external_but_git_dir_exists() { | |
&["init", "--git-repo", git_repo_path.to_str().unwrap()], | ||
); | ||
insta::assert_snapshot!(stdout, @""); | ||
insta::assert_snapshot!(stderr, @r###" | ||
insta::assert_snapshot!(stderr, @r#" | ||
Warning: Workspace has a .git directory that is not managed by JJ | ||
Warning: `--git` and `--git-repo` are deprecated. | ||
Use `jj git init` instead | ||
Initialized repo in "." | ||
"###); | ||
"#); | ||
|
||
// The local ".git" repository is unrelated, so no commits should be imported | ||
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "@-"]); | ||
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-r", "@-"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
◆ zzzzzzzz root() 00000000 | ||
"###); | ||
insta::assert_snapshot!(stderr, @" | ||
Warning: Workspace has a .git directory that is not managed by JJ | ||
"); | ||
|
||
// Check that Git HEAD is not set because this isn't a colocated repo | ||
test_env.jj_cmd_ok(&workspace_root, &["new"]); | ||
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "@-"]); | ||
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-r", "@-"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
○ qpvuntsm [email protected] 2001-02-03 08:05:07 230dd059 | ||
│ (empty) (no description set) | ||
~ | ||
"###); | ||
insta::assert_snapshot!(stderr, @" | ||
Warning: Workspace has a .git directory that is not managed by JJ | ||
"); | ||
} | ||
|
||
#[test] | ||
|