-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: unblock "jj git init --colocate" in existing Git repo directory
I'm not sure what's the conclusion in #2747, but I don't think there is a disagreement on allowing --colocate to import existing Git repo.
- Loading branch information
Showing
9 changed files
with
90 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -542,12 +542,29 @@ fn test_git_init_colocated_via_flag_git_dir_exists() { | |
let workspace_root = test_env.env_root().join("repo"); | ||
init_git_repo(&workspace_root, false); | ||
|
||
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "init", "--colocate"]); | ||
let (stdout, stderr) = | ||
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "--colocate", "repo"]); | ||
insta::assert_snapshot!(stdout, @""); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Failed to access the repository | ||
Caused by: | ||
1: Failed to initialize git repository | ||
2: Refusing to initialize the existing '$TEST_ENV/repo/.git' directory | ||
Done importing changes from the underlying Git repo. | ||
Initialized repo in "repo" | ||
"###); | ||
|
||
// Check that the Git repo's HEAD got checked out | ||
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "@-"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
◉ mwrttmos [email protected] 1970-01-01 01:02:03.000 +01:00 my-branch HEAD@git 8d698d4a | ||
│ My commit message | ||
~ | ||
"###); | ||
|
||
// Check that the Git repo's HEAD moves | ||
test_env.jj_cmd_ok(&workspace_root, &["new"]); | ||
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "@-"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
◉ sqpuoqvx [email protected] 2001-02-03 04:05:07.000 +07:00 HEAD@git f61b77cd | ||
│ (no description set) | ||
~ | ||
"###); | ||
} | ||
|
||
|
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