diff --git a/src/commands.rs b/src/commands.rs index d3b062826..5a7268bde 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -1733,7 +1733,10 @@ fn cmd_init(ui: &mut Ui, command: &CommandHelper, args: &ArgMatches) -> Result<( } if let Some(git_store_str) = args.value_of("git-repo") { - let git_store_path = ui.cwd().join(git_store_str); + let mut git_store_path = ui.cwd().join(git_store_str); + if !git_store_path.ends_with(".git") { + git_store_path = git_store_path.join(".git"); + } let (workspace, repo) = Workspace::init_external_git(ui.settings(), wc_path.clone(), git_store_path)?; let git_repo = repo.store().git_repo().unwrap(); diff --git a/tests/test_init_command.rs b/tests/test_init_command.rs index 2f781bff0..521fb99f0 100644 --- a/tests/test_init_command.rs +++ b/tests/test_init_command.rs @@ -75,7 +75,7 @@ fn test_init_git_external() { let git_target_file_contents = std::fs::read_to_string(store_path.join("git_target")).unwrap(); assert!(git_target_file_contents .replace('\\', "/") - .ends_with("/git-repo")); + .ends_with("/git-repo/.git")); } #[test]