tests: resolve directory path to run_jj_in() relative to env_root

Suppose we'll add test_env.init_workspace(path) or something, this will probably
make sense.
This commit is contained in:
Yuya Nishihara 2025-02-20 17:33:41 +09:00
parent 3634ff298c
commit 7fa8420908
67 changed files with 723 additions and 1888 deletions

View file

@ -78,11 +78,12 @@ impl Default for TestEnvironment {
impl TestEnvironment {
/// Runs `jj args..` in the `current_dir`, returns the output.
#[must_use = "either snapshot the output or assert the exit status with .success()"]
pub fn run_jj_in<I>(&self, current_dir: &Path, args: I) -> CommandOutput
pub fn run_jj_in<I>(&self, current_dir: impl AsRef<Path>, args: I) -> CommandOutput
where
I: IntoIterator,
I::Item: AsRef<OsStr>,
{
let current_dir = self.env_root.join(current_dir);
self.run_jj_with(|cmd| cmd.current_dir(current_dir).args(args))
}

View file

@ -38,9 +38,7 @@ fn create_commit(test_env: &TestEnvironment, repo_path: &Path, name: &str, paren
#[test]
fn test_basics() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -198,9 +196,7 @@ fn test_basics() {
#[test]
fn test_bug_2600() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// We will not touch "nottherootcommit". See the
@ -352,9 +348,7 @@ fn test_bug_2600() {
#[test]
fn test_bug_2600_rootcommit_special_case() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Set up like `test_bug_2600`, but without the `nottherootcommit` commit.
@ -388,9 +382,7 @@ fn test_bug_2600_rootcommit_special_case() {
#[test]
fn test_double_abandon() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -433,9 +425,7 @@ fn test_double_abandon() {
#[test]
fn test_abandon_restore_descendants() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "foo\n").unwrap();

View file

@ -20,9 +20,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_absorb_simple() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -163,9 +161,7 @@ fn test_absorb_simple() {
#[test]
fn test_absorb_replace_single_line_hunk() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -241,9 +237,7 @@ fn test_absorb_replace_single_line_hunk() {
#[test]
fn test_absorb_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -346,9 +340,7 @@ fn test_absorb_merge() {
#[test]
fn test_absorb_discardable_merge_with_descendant() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -435,9 +427,7 @@ fn test_absorb_discardable_merge_with_descendant() {
#[test]
fn test_absorb_conflict() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -503,9 +493,7 @@ fn test_absorb_conflict() {
#[test]
fn test_absorb_deleted_file() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -528,9 +516,7 @@ fn test_absorb_deleted_file() {
#[test]
fn test_absorb_file_mode() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -582,9 +568,7 @@ fn test_absorb_file_mode() {
#[test]
fn test_absorb_from_into() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.run_jj_in(&repo_path, ["new", "-m1"]).success();
@ -692,9 +676,7 @@ fn test_absorb_from_into() {
#[test]
fn test_absorb_paths() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -759,9 +741,7 @@ fn test_absorb_paths() {
#[test]
fn test_absorb_immutable() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config("revset-aliases.'immutable_heads()' = 'present(main)'");

View file

@ -19,9 +19,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_diff() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::create_dir(repo_path.join("dir")).unwrap();
@ -106,9 +104,7 @@ fn test_diff() {
#[test]
fn test_file_list_show() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("a-first"), "foo\n").unwrap();

View file

@ -66,9 +66,7 @@ fn describe_new_cmd(env: &TestEnvironment, workspace_path: &Path, commit_message
#[test_case(describe_new_cmd; "new")]
fn test_advance_bookmarks_enabled(make_commit: CommitFn) {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
// First, test with advance-bookmarks enabled. Start by creating a bookmark on
@ -121,9 +119,7 @@ fn test_advance_bookmarks_enabled(make_commit: CommitFn) {
#[test_case(describe_new_cmd; "new")]
fn test_advance_bookmarks_at_minus(make_commit: CommitFn) {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
set_advance_bookmarks(&test_env, true);
@ -178,9 +174,7 @@ fn test_advance_bookmarks_at_minus(make_commit: CommitFn) {
#[test_case(describe_new_cmd; "new")]
fn test_advance_bookmarks_overrides(make_commit: CommitFn) {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
// advance-bookmarks is disabled by default.
@ -307,9 +301,7 @@ fn test_advance_bookmarks_overrides(make_commit: CommitFn) {
#[test_case(describe_new_cmd; "new")]
fn test_advance_bookmarks_multiple_bookmarks(make_commit: CommitFn) {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
set_advance_bookmarks(&test_env, true);
@ -352,9 +344,7 @@ fn test_advance_bookmarks_multiple_bookmarks(make_commit: CommitFn) {
#[test]
fn test_new_advance_bookmarks_interior() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
set_advance_bookmarks(&test_env, true);
@ -409,9 +399,7 @@ fn test_new_advance_bookmarks_interior() {
#[test]
fn test_new_advance_bookmarks_before() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
set_advance_bookmarks(&test_env, true);
@ -465,9 +453,7 @@ fn test_new_advance_bookmarks_before() {
#[test]
fn test_new_advance_bookmarks_after() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
set_advance_bookmarks(&test_env, true);
@ -502,9 +488,7 @@ fn test_new_advance_bookmarks_after() {
#[test]
fn test_new_advance_bookmarks_merge_children() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
set_advance_bookmarks(&test_env, true);

View file

@ -19,9 +19,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_alias_basic() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(r#"aliases.bk = ["log", "-r", "@", "-T", "bookmarks"]"#);
@ -40,9 +38,7 @@ fn test_alias_basic() {
#[test]
fn test_alias_bad_name() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["foo."]);
@ -61,9 +57,7 @@ fn test_alias_bad_name() {
#[test]
fn test_alias_calls_empty_command() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
@ -104,9 +98,7 @@ fn test_alias_calls_empty_command() {
#[test]
fn test_alias_calls_unknown_command() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(r#"aliases.foo = ["nonexistent"]"#);
@ -128,9 +120,7 @@ fn test_alias_calls_unknown_command() {
#[test]
fn test_alias_calls_command_with_invalid_option() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(r#"aliases.foo = ["log", "--nonexistent"]"#);
@ -152,9 +142,7 @@ fn test_alias_calls_command_with_invalid_option() {
#[test]
fn test_alias_calls_help() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(r#"aliases.h = ["--help"]"#);
let output = test_env.run_jj_in(&repo_path, &["h"]);
@ -172,9 +160,7 @@ fn test_alias_calls_help() {
#[test]
fn test_alias_cannot_override_builtin() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(r#"aliases.log = ["rebase"]"#);
@ -192,9 +178,7 @@ fn test_alias_cannot_override_builtin() {
#[test]
fn test_alias_recursive() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
@ -225,9 +209,7 @@ fn test_alias_recursive() {
#[test]
fn test_alias_global_args_before_and_after() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(r#"aliases.l = ["log", "-T", "commit_id", "-r", "all()"]"#);
// Test the setup
@ -267,9 +249,7 @@ fn test_alias_global_args_before_and_after() {
#[test]
fn test_alias_global_args_in_definition() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
r#"aliases.l = ["log", "-T", "commit_id", "--at-op", "@-", "-r", "all()", "--color=always"]"#,
@ -293,7 +273,7 @@ fn test_alias_invalid_definition() {
non-string-list = [0]
"#,
);
let output = test_env.run_jj_in(test_env.env_root(), ["non-list"]);
let output = test_env.run_jj_in(".", ["non-list"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
------- stderr -------
Config error: Invalid type or value for aliases.non-list
@ -304,7 +284,7 @@ fn test_alias_invalid_definition() {
[EOF]
[exit status: 1]
");
let output = test_env.run_jj_in(test_env.env_root(), ["non-string-list"]);
let output = test_env.run_jj_in(".", ["non-string-list"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Config error: Invalid type or value for aliases.non-string-list
@ -320,14 +300,10 @@ fn test_alias_invalid_definition() {
#[test]
fn test_alias_in_repo_config() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo1"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo1"]).success();
let repo1_path = test_env.env_root().join("repo1");
fs::create_dir(repo1_path.join("sub")).unwrap();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo2"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo2"]).success();
let repo2_path = test_env.env_root().join("repo2");
fs::create_dir(repo2_path.join("sub")).unwrap();
@ -400,9 +376,7 @@ fn test_alias_in_repo_config() {
#[test]
fn test_alias_in_config_arg() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(r#"aliases.l = ['log', '-r@', '--no-graph', '-T"user alias\n"']"#);

View file

@ -46,9 +46,7 @@ fn create_commit(
#[test]
fn test_backout() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[], &[("a", "a\n")]);
@ -106,9 +104,7 @@ fn test_backout() {
#[test]
fn test_backout_multiple() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[], &[("a", "a\n")]);
@ -209,9 +205,7 @@ fn test_backout_multiple() {
#[test]
fn test_backout_description_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
test_env.add_config(
r#"
[templates]

View file

@ -45,9 +45,7 @@ fn create_commit_with_refs(
#[test]
fn test_bookmark_multiple_names() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["bookmark", "create", "-r@", "foo", "bar"]);
@ -118,9 +116,7 @@ fn test_bookmark_multiple_names() {
#[test]
fn test_bookmark_at_root() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["bookmark", "create", "fred", "-r=root()"]);
@ -142,9 +138,7 @@ fn test_bookmark_at_root() {
#[test]
fn test_bookmark_bad_name() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["bookmark", "create", "-r@", ""]);
@ -223,9 +217,7 @@ fn test_bookmark_bad_name() {
#[test]
fn test_bookmark_move() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Set up remote
@ -377,9 +369,7 @@ fn test_bookmark_move() {
#[test]
fn test_bookmark_move_matching() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -513,9 +503,7 @@ fn test_bookmark_move_matching() {
#[test]
fn test_bookmark_move_conflicting() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let get_log = || {
let template = r#"separate(" ", description.first_line(), bookmarks)"#;
@ -601,9 +589,7 @@ fn test_bookmark_move_conflicting() {
#[test]
fn test_bookmark_rename() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Set up remote
@ -678,7 +664,7 @@ fn test_bookmark_rename() {
fn test_bookmark_rename_colocated() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo", "--colocate"])
.run_jj_in(".", ["git", "init", "repo", "--colocate"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -697,9 +683,7 @@ fn test_bookmark_rename_colocated() {
#[test]
fn test_bookmark_forget_glob() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -784,9 +768,7 @@ fn test_bookmark_forget_glob() {
fn test_bookmark_delete_glob() {
// Set up a git repo with a bookmark and a jj repo that has it as a remote.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let git_repo_path = test_env.env_root().join("git-repo");
let git_repo = git::init_bare(git_repo_path);
@ -916,9 +898,7 @@ fn test_bookmark_delete_glob() {
#[test]
fn test_bookmark_delete_export() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.run_jj_in(&repo_path, ["new"]).success();
@ -948,9 +928,7 @@ fn test_bookmark_delete_export() {
#[test]
fn test_bookmark_forget_export() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.run_jj_in(&repo_path, ["new"]).success();
@ -1003,9 +981,7 @@ fn test_bookmark_forget_fetched_bookmark() {
// Set up a git repo with a bookmark and a jj repo that has it as a remote.
let test_env = TestEnvironment::default();
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let git_repo_path = test_env.env_root().join("git-repo");
let git_repo = git::init_bare(git_repo_path);
@ -1164,9 +1140,7 @@ fn test_bookmark_forget_deleted_or_nonexistent_bookmark() {
// Set up a git repo with a bookmark and a jj repo that has it as a remote.
let test_env = TestEnvironment::default();
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let git_repo_path = test_env.env_root().join("git-repo");
let git_repo = git::init_bare(git_repo_path);
@ -1223,9 +1197,7 @@ fn test_bookmark_forget_deleted_or_nonexistent_bookmark() {
#[test]
fn test_bookmark_track_untrack() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Set up remote
@ -1420,9 +1392,7 @@ fn test_bookmark_track_untrack() {
#[test]
fn test_bookmark_track_conflict() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let git_repo_path = test_env.env_root().join("git-repo");
@ -1466,9 +1436,7 @@ fn test_bookmark_track_conflict() {
#[test]
fn test_bookmark_track_untrack_patterns() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Set up remote
@ -1631,9 +1599,7 @@ fn test_bookmark_list() {
test_env.add_config("git.auto-local-bookmark = true");
// Initialize remote refs
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "remote"])
.success();
test_env.run_jj_in(".", ["git", "init", "remote"]).success();
let remote_path = test_env.env_root().join("remote");
for bookmark in [
"remote-sync",
@ -1658,7 +1624,7 @@ fn test_bookmark_list() {
remote_git_path.extend([".jj", "repo", "store", "git"]);
test_env
.run_jj_in(
test_env.env_root(),
".",
["git", "clone", remote_git_path.to_str().unwrap(), "local"],
)
.success();
@ -1841,9 +1807,7 @@ fn test_bookmark_list_filtered() {
test_env.add_config(r#"revset-aliases."immutable_heads()" = "none()""#);
// Initialize remote refs
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "remote"])
.success();
test_env.run_jj_in(".", ["git", "init", "remote"]).success();
let remote_path = test_env.env_root().join("remote");
for bookmark in ["remote-keep", "remote-delete", "remote-rewrite"] {
test_env
@ -1863,7 +1827,7 @@ fn test_bookmark_list_filtered() {
remote_git_path.extend([".jj", "repo", "store", "git"]);
test_env
.run_jj_in(
test_env.env_root(),
".",
["git", "clone", remote_git_path.to_str().unwrap(), "local"],
)
.success();
@ -2077,9 +2041,7 @@ fn test_bookmark_list_much_remote_divergence() {
test_env.add_config("git.auto-local-bookmark = true");
// Initialize remote refs
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "remote"])
.success();
test_env.run_jj_in(".", ["git", "init", "remote"]).success();
let remote_path = test_env.env_root().join("remote");
test_env
.run_jj_in(&remote_path, ["new", "root()", "-m", "remote-unsync"])
@ -2102,7 +2064,7 @@ fn test_bookmark_list_much_remote_divergence() {
remote_git_path.extend([".jj", "repo", "store", "git"]);
test_env
.run_jj_in(
test_env.env_root(),
".",
["git", "clone", remote_git_path.to_str().unwrap(), "local"],
)
.success();
@ -2148,9 +2110,7 @@ fn test_bookmark_list_tracked() {
test_env.add_config("git.auto-local-bookmark = true");
// Initialize remote refs
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "remote"])
.success();
test_env.run_jj_in(".", ["git", "init", "remote"]).success();
let remote_path = test_env.env_root().join("remote");
for bookmark in [
"remote-sync",
@ -2175,7 +2135,7 @@ fn test_bookmark_list_tracked() {
remote_git_path.extend([".jj", "repo", "store", "git"]);
test_env
.run_jj_in(
test_env.env_root(),
".",
[
"git",
"clone",
@ -2187,7 +2147,7 @@ fn test_bookmark_list_tracked() {
.success();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "upstream"])
.run_jj_in(".", ["git", "init", "upstream"])
.success();
// Initialize a second remote
@ -2368,9 +2328,7 @@ fn test_bookmark_list_tracked() {
#[test]
fn test_bookmark_list_conflicted() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Track existing bookmark. Local bookmark should result in conflict.
@ -2421,9 +2379,7 @@ fn test_bookmark_list_conflicted() {
#[test]
fn test_bookmark_create_with_default_target_revision() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["bookmark", "create", "foo"]);
@ -2438,9 +2394,7 @@ fn test_bookmark_create_with_default_target_revision() {
#[test]
fn test_bookmark_set_with_default_target_revision() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["bookmark", "set", "foo"]);
@ -2455,9 +2409,7 @@ fn test_bookmark_set_with_default_target_revision() {
#[test]
fn test_bookmark_move_with_default_target_revision() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Set up remote

View file

@ -18,9 +18,7 @@ use crate::common::TestEnvironment;
fn set_up(trunk_name: &str) -> (TestEnvironment, PathBuf) {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "origin"])
.success();
test_env.run_jj_in(".", ["git", "init", "origin"]).success();
let origin_path = test_env.env_root().join("origin");
let origin_git_repo_path = origin_path
.join(".jj")
@ -49,7 +47,7 @@ fn set_up(trunk_name: &str) -> (TestEnvironment, PathBuf) {
test_env
.run_jj_in(
test_env.env_root(),
".",
[
"git",
"clone",

View file

@ -21,9 +21,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_commit_with_description_from_cli() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
// Description applies to the current working-copy (not the new one)
@ -41,9 +39,7 @@ fn test_commit_with_description_from_cli() {
#[test]
fn test_commit_with_editor() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
// Check that the text file gets initialized with the current description and
@ -90,9 +86,7 @@ fn test_commit_with_editor() {
#[test]
fn test_commit_with_editor_avoids_unc() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -110,9 +104,7 @@ fn test_commit_with_editor_avoids_unc() {
#[test]
fn test_commit_interactive() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
std::fs::write(workspace_path.join("file1"), "foo\n").unwrap();
@ -190,9 +182,7 @@ fn test_commit_interactive() {
#[test]
fn test_commit_interactive_with_paths() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
std::fs::write(workspace_path.join("file2"), "").unwrap();
@ -255,9 +245,7 @@ fn test_commit_interactive_with_paths() {
#[test]
fn test_commit_with_default_description() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
test_env.add_config(r#"ui.default-description = "\n\nTESTED=TODO""#);
let workspace_path = test_env.env_root().join("repo");
@ -288,9 +276,7 @@ fn test_commit_with_default_description() {
#[test]
fn test_commit_with_description_template() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
test_env.add_config(
r#"
[templates]
@ -377,9 +363,7 @@ fn test_commit_with_description_template() {
#[test]
fn test_commit_without_working_copy() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
@ -397,9 +381,7 @@ fn test_commit_without_working_copy() {
#[test]
fn test_commit_paths() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
std::fs::write(workspace_path.join("file1"), "foo\n").unwrap();
@ -426,9 +408,7 @@ fn test_commit_paths() {
#[test]
fn test_commit_paths_warning() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
std::fs::write(workspace_path.join("file1"), "foo\n").unwrap();
@ -456,9 +436,7 @@ fn test_commit_paths_warning() {
#[test]
fn test_commit_reset_author() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(

View file

@ -21,9 +21,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_log_parents() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.run_jj_in(&repo_path, ["new"]).success();
@ -103,9 +101,7 @@ fn test_log_parents() {
#[test]
fn test_log_author_timestamp() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -127,9 +123,7 @@ fn test_log_author_timestamp() {
#[test]
fn test_log_author_timestamp_ago() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -153,9 +147,7 @@ fn test_log_author_timestamp_ago() {
#[test]
fn test_log_author_timestamp_utc() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "author.timestamp().utc()"]);
@ -170,9 +162,7 @@ fn test_log_author_timestamp_utc() {
#[test]
fn test_log_author_timestamp_local() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_env_var("TZ", "UTC-05:30");
@ -194,9 +184,7 @@ fn test_log_author_timestamp_local() {
#[test]
fn test_log_author_timestamp_after_before() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -240,9 +228,7 @@ fn test_log_author_timestamp_after_before() {
#[test]
fn test_mine_is_true_when_author_is_user() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(
@ -274,9 +260,7 @@ fn test_mine_is_true_when_author_is_user() {
#[test]
fn test_log_default() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -327,9 +311,7 @@ fn test_log_default() {
#[test]
fn test_log_default_without_working_copy() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -345,9 +327,7 @@ fn test_log_default_without_working_copy() {
#[test]
fn test_log_builtin_templates() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Render without graph to test line ending
let render = |template| test_env.run_jj_in(&repo_path, ["log", "-T", template, "--no-graph"]);
@ -420,9 +400,7 @@ fn test_log_builtin_templates() {
#[test]
fn test_log_builtin_templates_colored() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render =
|template| test_env.run_jj_in(&repo_path, ["--color=always", "log", "-T", template]);
@ -495,9 +473,7 @@ fn test_log_builtin_templates_colored() {
#[test]
fn test_log_builtin_templates_colored_debug() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render =
|template| test_env.run_jj_in(&repo_path, ["--color=debug", "log", "-T", template]);
@ -570,9 +546,7 @@ fn test_log_builtin_templates_colored_debug() {
#[test]
fn test_log_evolog_divergence() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "foo\n").unwrap();
@ -650,9 +624,7 @@ fn test_log_bookmarks() {
test_env.add_config("git.auto-local-bookmark = true");
test_env.add_config(r#"revset-aliases."immutable_heads()" = "none()""#);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "origin"])
.success();
test_env.run_jj_in(".", ["git", "init", "origin"]).success();
let origin_path = test_env.env_root().join("origin");
let origin_git_repo_path = origin_path
.join(".jj")
@ -687,7 +659,7 @@ fn test_log_bookmarks() {
.success();
test_env
.run_jj_in(
test_env.env_root(),
".",
[
"git",
"clone",
@ -835,9 +807,7 @@ fn test_log_git_head() {
#[test]
fn test_log_commit_id_normal_hex() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -867,9 +837,7 @@ fn test_log_commit_id_normal_hex() {
#[test]
fn test_log_change_id_normal_hex() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -899,9 +867,7 @@ fn test_log_change_id_normal_hex() {
#[test]
fn test_log_customize_short_id() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -944,9 +910,7 @@ fn test_log_customize_short_id() {
#[test]
fn test_log_immutable() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["new", "-mA", "root()"])
@ -1020,9 +984,7 @@ fn test_log_immutable() {
#[test]
fn test_log_contained_in() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["new", "-mA", "root()"])
@ -1161,9 +1123,7 @@ fn test_log_contained_in() {
#[test]
fn test_short_prefix_in_transaction() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(r#"
@ -1242,9 +1202,7 @@ fn test_short_prefix_in_transaction() {
#[test]
fn test_log_diff_predefined_formats() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\nb\n").unwrap();
@ -1367,10 +1325,7 @@ fn test_log_diff_predefined_formats() {
");
// cwd != workspace root
let output = test_env.run_jj_in(
test_env.env_root(),
["log", "-Rrepo", "--no-graph", "-r@", "-T", template],
);
let output = test_env.run_jj_in(".", ["log", "-Rrepo", "--no-graph", "-r@", "-T", template]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
=== color_words ===
Modified regular file repo/file1:
@ -1589,9 +1544,7 @@ fn test_log_diff_predefined_formats() {
#[test]
fn test_file_list_entries() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::create_dir(repo_path.join("dir")).unwrap();
@ -1639,9 +1592,7 @@ fn test_file_list_entries() {
#[test]
fn test_file_list_symlink() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::os::unix::fs::symlink("symlink_target", repo_path.join("symlink")).unwrap();
@ -1657,9 +1608,7 @@ fn test_file_list_symlink() {
#[test]
fn test_repo_path() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::create_dir(repo_path.join("dir")).unwrap();
@ -1694,9 +1643,7 @@ fn test_repo_path() {
fn test_signature_templates() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env

View file

@ -17,14 +17,10 @@ use crate::common::TestEnvironment;
#[test]
fn test_bookmark_names() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "origin"])
.success();
test_env.run_jj_in(".", ["git", "init", "origin"]).success();
let origin_path = test_env.env_root().join("origin");
let origin_git_repo_path = origin_path
.join(".jj")
@ -193,9 +189,7 @@ fn test_bookmark_names() {
#[test]
fn test_global_arg_repository_is_respected() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -207,7 +201,7 @@ fn test_global_arg_repository_is_respected() {
let test_env = test_env;
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"--",
"jj",
@ -227,9 +221,7 @@ fn test_global_arg_repository_is_respected() {
#[test]
fn test_aliases_are_resolved() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -271,12 +263,12 @@ fn test_completions_are_generated() {
insta_settings.add_filter(r"(--arguments) .*", "$1 .."); // omit path to jj binary
let _guard = insta_settings.bind_to_scope();
let output = test_env.run_jj_in(test_env.env_root(), [""; 0]);
let output = test_env.run_jj_in(".", [""; 0]);
insta::assert_snapshot!(output, @r"
complete --keep-order --exclusive --command jj --arguments ..
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["--"]);
let output = test_env.run_jj_in(".", ["--"]);
insta::assert_snapshot!(output, @r"
complete --keep-order --exclusive --command jj --arguments ..
[EOF]
@ -321,68 +313,48 @@ fn test_zsh_completion() {
#[test]
fn test_remote_names() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init"])
.success();
test_env.run_jj_in(".", ["git", "init"]).success();
test_env
.run_jj_in(
test_env.env_root(),
".",
["git", "remote", "add", "origin", "git@git.local:user/repo"],
)
.success();
test_env.add_env_var("COMPLETE", "fish");
let output = test_env.run_jj_in(
test_env.env_root(),
["--", "jj", "git", "remote", "remove", "o"],
);
let output = test_env.run_jj_in(".", ["--", "jj", "git", "remote", "remove", "o"]);
insta::assert_snapshot!(output, @r"
origin
[EOF]
");
let output = test_env.run_jj_in(
test_env.env_root(),
["--", "jj", "git", "remote", "rename", "o"],
);
let output = test_env.run_jj_in(".", ["--", "jj", "git", "remote", "rename", "o"]);
insta::assert_snapshot!(output, @r"
origin
[EOF]
");
let output = test_env.run_jj_in(
test_env.env_root(),
["--", "jj", "git", "remote", "set-url", "o"],
);
let output = test_env.run_jj_in(".", ["--", "jj", "git", "remote", "set-url", "o"]);
insta::assert_snapshot!(output, @r"
origin
[EOF]
");
let output = test_env.run_jj_in(
test_env.env_root(),
["--", "jj", "git", "push", "--remote", "o"],
);
let output = test_env.run_jj_in(".", ["--", "jj", "git", "push", "--remote", "o"]);
insta::assert_snapshot!(output, @r"
origin
[EOF]
");
let output = test_env.run_jj_in(
test_env.env_root(),
["--", "jj", "git", "fetch", "--remote", "o"],
);
let output = test_env.run_jj_in(".", ["--", "jj", "git", "fetch", "--remote", "o"]);
insta::assert_snapshot!(output, @r"
origin
[EOF]
");
let output = test_env.run_jj_in(
test_env.env_root(),
["--", "jj", "bookmark", "list", "--remote", "o"],
);
let output = test_env.run_jj_in(".", ["--", "jj", "bookmark", "list", "--remote", "o"]);
insta::assert_snapshot!(output, @r"
origin
[EOF]
@ -392,9 +364,7 @@ fn test_remote_names() {
#[test]
fn test_aliases_are_completed() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// user config alias
@ -425,7 +395,7 @@ fn test_aliases_are_completed() {
// make sure --repository flag is respected
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"--",
"jj",
@ -441,7 +411,7 @@ fn test_aliases_are_completed() {
// cannot load aliases from --config flag
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"--",
"jj",
@ -455,15 +425,11 @@ fn test_aliases_are_completed() {
#[test]
fn test_revisions() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// create remote to test remote branches
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "origin"])
.success();
test_env.run_jj_in(".", ["git", "init", "origin"]).success();
let origin_path = test_env.env_root().join("origin");
let origin_git_repo_path = origin_path
.join(".jj")
@ -581,9 +547,7 @@ fn test_operations() {
// suppress warnings on stderr of completions for invalid args
test_env.add_config("ui.default-command = 'log'");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["describe", "-m", "description 0"])
@ -679,9 +643,7 @@ fn test_operations() {
#[test]
fn test_workspaces() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
std::fs::write(main_path.join("file"), "contents").unwrap();
@ -838,9 +800,7 @@ fn create_commit(
#[test]
fn test_files() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(

View file

@ -22,9 +22,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_concurrent_operation_divergence() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -73,9 +71,7 @@ fn test_concurrent_operation_divergence() {
#[test]
fn test_concurrent_operations_auto_rebase() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "contents").unwrap();
@ -124,9 +120,7 @@ fn test_concurrent_operations_auto_rebase() {
#[test]
fn test_concurrent_operations_wc_modified() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "contents\n").unwrap();
@ -195,9 +189,7 @@ fn test_concurrent_operations_wc_modified() {
#[test]
fn test_concurrent_snapshot_wc_reloadable() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let op_heads_dir = repo_path
.join(".jj")

View file

@ -31,17 +31,14 @@ fn test_config_list_single() {
"#,
);
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "list", "test-table.somekey"],
);
let output = test_env.run_jj_in(".", ["config", "list", "test-table.somekey"]);
insta::assert_snapshot!(output, @r#"
test-table.somekey = "some value"
[EOF]
"#);
let output = test_env.run_jj_in(
test_env.env_root(),
".",
["config", "list", r#"-Tname ++ "\n""#, "test-table.somekey"],
);
insta::assert_snapshot!(output, @r"
@ -53,10 +50,7 @@ fn test_config_list_single() {
#[test]
fn test_config_list_nonexistent() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "list", "nonexistent-test-key"],
);
let output = test_env.run_jj_in(".", ["config", "list", "nonexistent-test-key"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Warning: No matching config key for nonexistent-test-key
@ -76,7 +70,7 @@ fn test_config_list_table() {
"z"."with space"."function()" = 5
"#,
);
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-table"]);
let output = test_env.run_jj_in(".", ["config", "list", "test-table"]);
insta::assert_snapshot!(output, @r#"
test-table.x = true
test-table.y.foo = "abc"
@ -95,14 +89,14 @@ fn test_config_list_inline_table() {
"#,
);
// Inline tables are expanded
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-table"]);
let output = test_env.run_jj_in(".", ["config", "list", "test-table"]);
insta::assert_snapshot!(output, @r"
test-table.x = true
test-table.y = 1
[EOF]
");
// Inner value can also be addressed by a dotted name path
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-table.x"]);
let output = test_env.run_jj_in(".", ["config", "list", "test-table.x"]);
insta::assert_snapshot!(output, @r"
test-table.x = true
[EOF]
@ -117,7 +111,7 @@ fn test_config_list_array() {
test-array = [1, "b", 3.4]
"#,
);
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-array"]);
let output = test_env.run_jj_in(".", ["config", "list", "test-array"]);
insta::assert_snapshot!(output, @r#"
test-array = [1, "b", 3.4]
[EOF]
@ -137,7 +131,7 @@ fn test_config_list_array_of_tables() {
"#,
);
// Array is a value, so is array of tables
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-table"]);
let output = test_env.run_jj_in(".", ["config", "list", "test-table"]);
insta::assert_snapshot!(output, @r#"
test-table = [{ x = 1 }, { y = ["z"], z = { "key=with whitespace" = [] } }]
[EOF]
@ -157,7 +151,7 @@ fn test_config_list_all() {
"#,
);
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list"]);
let output = test_env.run_jj_in(".", ["config", "list"]);
insta::assert_snapshot!(
output.normalize_stdout_with(|s| find_stdout_lines(r"(test-val|test-table\b[^=]*)", &s)), @r#"
test-val = [1, 2, 3]
@ -180,7 +174,7 @@ bar
"#,
);
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "multiline"]);
let output = test_env.run_jj_in(".", ["config", "list", "multiline"]);
insta::assert_snapshot!(output, @r"
multiline = '''
foo
@ -190,7 +184,7 @@ bar
");
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"config",
"list",
@ -212,9 +206,7 @@ bar
#[test]
fn test_config_list_layer() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
// Test with fresh new config file
let user_config_path = test_env.config_path().join("config.toml");
test_env.set_config_path(&user_config_path);
@ -278,9 +270,7 @@ fn test_config_list_layer() {
#[test]
fn test_config_layer_override_default() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let config_key = "merge-tools.vimdiff.program";
@ -372,9 +362,7 @@ fn test_config_layer_override_default() {
#[test]
fn test_config_layer_override_env() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let config_key = "ui.editor";
@ -458,9 +446,7 @@ fn test_config_layer_override_env() {
#[test]
fn test_config_layer_workspace() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
let config_key = "ui.editor";
@ -498,7 +484,7 @@ fn test_config_layer_workspace() {
#[test]
fn test_config_set_bad_opts() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(test_env.env_root(), ["config", "set"]);
let output = test_env.run_jj_in(".", ["config", "set"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: the following required arguments were not provided:
@ -513,7 +499,7 @@ fn test_config_set_bad_opts() {
[exit status: 2]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "set", "--user", "", "x"]);
let output = test_env.run_jj_in(".", ["config", "set", "--user", "", "x"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: invalid value '' for '<NAME>': TOML parse error at line 1, column 1
@ -528,10 +514,7 @@ fn test_config_set_bad_opts() {
[exit status: 2]
");
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "set", "--user", "x", "['typo'}"],
);
let output = test_env.run_jj_in(".", ["config", "set", "--user", "x", "['typo'}"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: invalid value '['typo'}' for '<VALUE>': TOML parse error at line 1, column 8
@ -551,9 +534,7 @@ fn test_config_set_bad_opts() {
#[test]
fn test_config_set_for_user() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
// Test with fresh new config file
let user_config_path = test_env.config_path().join("config.toml");
test_env.set_config_path(&user_config_path);
@ -595,10 +576,7 @@ fn test_config_set_for_user_directory() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(
test_env.env_root(),
["config", "set", "--user", "test-key", "test-val"],
)
.run_jj_in(".", ["config", "set", "--user", "test-key", "test-val"])
.success();
insta::assert_snapshot!(
std::fs::read_to_string(test_env.last_config_file_path()).unwrap(),
@ -611,10 +589,7 @@ fn test_config_set_for_user_directory() {
// Add one more config file to the directory
test_env.add_config("");
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "set", "--user", "test-key", "test-val"],
);
let output = test_env.run_jj_in(".", ["config", "set", "--user", "test-key", "test-val"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Error: Cannot determine config file to edit:
@ -628,9 +603,7 @@ fn test_config_set_for_user_directory() {
#[test]
fn test_config_set_for_repo() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(
@ -664,9 +637,7 @@ fn test_config_set_for_repo() {
#[test]
fn test_config_set_toml_types() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
// Test with fresh new config file
let user_config_path = test_env.config_path().join("config.toml");
test_env.set_config_path(&user_config_path);
@ -697,9 +668,7 @@ fn test_config_set_toml_types() {
#[test]
fn test_config_set_type_mismatch() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -750,9 +719,7 @@ fn test_config_set_type_mismatch() {
#[test]
fn test_config_set_nontable_parent() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -777,9 +744,7 @@ fn test_config_set_nontable_parent() {
#[test]
fn test_config_unset_non_existent_key() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["config", "unset", "--user", "nonexistent"]);
@ -797,9 +762,7 @@ fn test_config_unset_inline_table_key() {
// Test with fresh new config file
let user_config_path = test_env.config_path().join("config.toml");
test_env.set_config_path(&user_config_path);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -837,16 +800,10 @@ fn test_config_unset_table_like() {
// Inline table is syntactically a "value", so it can be deleted.
test_env
.run_jj_in(
test_env.env_root(),
["config", "unset", "--user", "inline-table"],
)
.run_jj_in(".", ["config", "unset", "--user", "inline-table"])
.success();
// Non-inline table cannot be deleted.
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "unset", "--user", "non-inline-table"],
);
let output = test_env.run_jj_in(".", ["config", "unset", "--user", "non-inline-table"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Error: Failed to unset non-inline-table
@ -865,9 +822,7 @@ fn test_config_unset_table_like() {
#[test]
fn test_config_unset_for_user() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
// Test with fresh new config file
let user_config_path = test_env.config_path().join("config.toml");
test_env.set_config_path(&user_config_path);
@ -906,9 +861,7 @@ fn test_config_unset_for_user() {
#[test]
fn test_config_unset_for_repo() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -929,7 +882,7 @@ fn test_config_unset_for_repo() {
#[test]
fn test_config_edit_missing_opt() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(test_env.env_root(), ["config", "edit"]);
let output = test_env.run_jj_in(".", ["config", "edit"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: the following required arguments were not provided:
@ -946,9 +899,7 @@ fn test_config_edit_missing_opt() {
#[test]
fn test_config_edit_user() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Remove one of the config file to disambiguate
std::fs::remove_file(test_env.last_config_file_path()).unwrap();
@ -977,7 +928,7 @@ fn test_config_edit_user_new_file() {
assert!(!user_config_path.exists());
test_env
.run_jj_in(test_env.env_root(), ["config", "edit", "--user"])
.run_jj_in(".", ["config", "edit", "--user"])
.success();
assert!(
user_config_path.exists(),
@ -988,9 +939,7 @@ fn test_config_edit_user_new_file() {
#[test]
fn test_config_edit_repo() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let repo_config_path = repo_path.join(PathBuf::from_iter([".jj", "repo", "config.toml"]));
let edit_script = test_env.set_up_fake_editor();
@ -1010,9 +959,7 @@ fn test_config_edit_repo() {
#[test]
fn test_config_path() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let user_config_path = test_env.env_root().join("config.toml");
@ -1039,8 +986,7 @@ fn test_config_path() {
"jj config path shouldn't create new file"
);
insta::assert_snapshot!(
test_env.run_jj_in(test_env.env_root(), ["config", "path", "--repo"]), @r"
insta::assert_snapshot!(test_env.run_jj_in(".", ["config", "path", "--repo"]), @r"
------- stderr -------
Error: No repo config path found
[EOF]
@ -1051,7 +997,7 @@ fn test_config_path() {
#[test]
fn test_config_edit_repo_outside_repo() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(test_env.env_root(), ["config", "edit", "--repo"]);
let output = test_env.run_jj_in(".", ["config", "edit", "--repo"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Error: No repo config path found to edit
@ -1079,7 +1025,7 @@ fn test_config_get() {
"#,
);
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "nonexistent"]);
let output = test_env.run_jj_in(".", ["config", "get", "nonexistent"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Config error: Value not found for nonexistent
@ -1088,19 +1034,19 @@ fn test_config_get() {
[exit status: 1]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.string"]);
let output = test_env.run_jj_in(".", ["config", "get", "table.string"]);
insta::assert_snapshot!(output, @r"
some value 1
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.int"]);
let output = test_env.run_jj_in(".", ["config", "get", "table.int"]);
insta::assert_snapshot!(output, @r"
123
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.list"]);
let output = test_env.run_jj_in(".", ["config", "get", "table.list"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Config error: Invalid type or value for table.list
@ -1111,7 +1057,7 @@ fn test_config_get() {
[exit status: 1]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table"]);
let output = test_env.run_jj_in(".", ["config", "get", "table"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Config error: Invalid type or value for table
@ -1122,7 +1068,7 @@ fn test_config_get() {
[exit status: 1]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.overridden"]);
let output = test_env.run_jj_in(".", ["config", "get", "table.overridden"]);
insta::assert_snapshot!(output, @r"
bar
[EOF]
@ -1143,41 +1089,41 @@ fn test_config_path_syntax() {
"#,
);
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "a.'b()'"]);
let output = test_env.run_jj_in(".", ["config", "list", "a.'b()'"]);
insta::assert_snapshot!(output, @r"
a.'b()' = 0
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'b c'"]);
let output = test_env.run_jj_in(".", ["config", "list", "'b c'"]);
insta::assert_snapshot!(output, @r#"
'b c'.d = 1
'b c'.e."f[]" = 2
[EOF]
"#);
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'b c'.d"]);
let output = test_env.run_jj_in(".", ["config", "list", "'b c'.d"]);
insta::assert_snapshot!(output, @r"
'b c'.d = 1
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'b c'.e.'f[]'"]);
let output = test_env.run_jj_in(".", ["config", "list", "'b c'.e.'f[]'"]);
insta::assert_snapshot!(output, @r"
'b c'.e.'f[]' = 2
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "'b c'.e.'f[]'"]);
let output = test_env.run_jj_in(".", ["config", "get", "'b c'.e.'f[]'"]);
insta::assert_snapshot!(output, @r"
2
[EOF]
");
// Not a table
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "a.'b()'.x"]);
let output = test_env.run_jj_in(".", ["config", "list", "a.'b()'.x"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Warning: No matching config key for a.'b()'.x
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "a.'b()'.x"]);
let output = test_env.run_jj_in(".", ["config", "get", "a.'b()'.x"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Config error: Value not found for a.'b()'.x
@ -1187,29 +1133,29 @@ fn test_config_path_syntax() {
");
// "-" and "_" are valid TOML keys
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "-"]);
let output = test_env.run_jj_in(".", ["config", "list", "-"]);
insta::assert_snapshot!(output, @r"
- = 3
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "_"]);
let output = test_env.run_jj_in(".", ["config", "list", "_"]);
insta::assert_snapshot!(output, @r"
_ = 4
[EOF]
");
// "." requires quoting
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'.'"]);
let output = test_env.run_jj_in(".", ["config", "list", "'.'"]);
insta::assert_snapshot!(output, @r"
'.' = 5
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "'.'"]);
let output = test_env.run_jj_in(".", ["config", "get", "'.'"]);
insta::assert_snapshot!(output, @r"
5
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "."]);
let output = test_env.run_jj_in(".", ["config", "get", "."]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: invalid value '.' for '<NAME>': TOML parse error at line 1, column 1
@ -1225,7 +1171,7 @@ fn test_config_path_syntax() {
");
// Invalid TOML keys
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "b c"]);
let output = test_env.run_jj_in(".", ["config", "list", "b c"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: invalid value 'b c' for '[NAME]': TOML parse error at line 1, column 3
@ -1239,7 +1185,7 @@ fn test_config_path_syntax() {
[EOF]
[exit status: 2]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", ""]);
let output = test_env.run_jj_in(".", ["config", "list", ""]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: invalid value '' for '[NAME]': TOML parse error at line 1, column 1
@ -1298,7 +1244,7 @@ fn test_config_conditional() {
.unwrap();
// get and list should refer to the resolved config
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "foo"]);
let output = test_env.run_jj_in(".", ["config", "get", "foo"]);
insta::assert_snapshot!(output, @r"
global
[EOF]
@ -1320,7 +1266,7 @@ fn test_config_conditional() {
get
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "--user"]);
let output = test_env.run_jj_in(".", ["config", "list", "--user"]);
insta::assert_snapshot!(output, @r"
foo = 'global'
baz = 'config'
@ -1353,10 +1299,7 @@ fn test_config_conditional() {
// set and unset should refer to the source config
// (there's no option to update scoped table right now.)
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "set", "--user", "bar", "new value"],
);
let output = test_env.run_jj_in(".", ["config", "set", "--user", "bar", "new value"]);
insta::assert_snapshot!(output, @"");
insta::assert_snapshot!(std::fs::read_to_string(&user_config_path).unwrap(), @r#"
foo = 'global'
@ -1412,9 +1355,7 @@ fn test_config_conditional() {
#[test]
fn test_config_conditional_without_home_dir() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Test with fresh new config file
let user_config_path = test_env.env_root().join("config.toml");
@ -1434,7 +1375,7 @@ fn test_config_conditional_without_home_dir() {
)
.unwrap();
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "foo"]);
let output = test_env.run_jj_in(".", ["config", "get", "foo"]);
insta::assert_snapshot!(output, @r"
global
[EOF]
@ -1449,9 +1390,7 @@ fn test_config_conditional_without_home_dir() {
#[test]
fn test_config_show_paths() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1460,7 +1399,7 @@ fn test_config_show_paths() {
["config", "set", "--user", "ui.paginate", ":builtin"],
)
.success();
let output = test_env.run_jj_in(test_env.env_root(), ["st"]);
let output = test_env.run_jj_in(".", ["st"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Config error: Invalid type or value for ui.paginate
@ -1476,9 +1415,7 @@ fn test_config_show_paths() {
#[test]
fn test_config_author_change_warning() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(
&repo_path,
@ -1514,10 +1451,7 @@ fn test_config_author_change_warning() {
#[test]
fn test_config_author_change_warning_root_env() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "set", "--user", "user.email", "'Foo'"],
);
let output = test_env.run_jj_in(".", ["config", "set", "--user", "user.email", "'Foo'"]);
insta::assert_snapshot!(output, @"");
}

View file

@ -17,9 +17,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_simple_rename() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.run_jj_in(&repo_path, ["new"]).success();

View file

@ -21,9 +21,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_debug_fileset() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&workspace_path, ["debug", "fileset", "all()"]);
@ -57,9 +55,7 @@ fn test_debug_fileset() {
#[test]
fn test_debug_revset() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&workspace_path, ["debug", "revset", "root()"]);
@ -96,9 +92,7 @@ fn test_debug_revset() {
#[test]
fn test_debug_index() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&workspace_path, ["debug", "index"]);
assert_snapshot!(filter_index_stats(output), @r"
@ -119,9 +113,7 @@ fn test_debug_index() {
#[test]
fn test_debug_reindex() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env.run_jj_in(&workspace_path, ["new"]).success();
test_env.run_jj_in(&workspace_path, ["new"]).success();
@ -167,9 +159,7 @@ fn test_debug_reindex() {
#[test]
fn test_debug_tree() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
let subdir = workspace_path.join("dir").join("subdir");
std::fs::create_dir_all(&subdir).unwrap();
@ -256,9 +246,7 @@ fn test_debug_tree() {
#[test]
fn test_debug_operation_id() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&workspace_path, ["debug", "operation", "--display", "id"]);
assert_snapshot!(filter_index_stats(output), @r"

View file

@ -23,9 +23,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_describe() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -200,9 +198,7 @@ fn test_describe() {
#[test]
fn test_describe_editor_env() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Fails if the editor doesn't exist
@ -275,9 +271,7 @@ fn test_describe_editor_env() {
#[test]
fn test_describe_multiple_commits() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -551,9 +545,7 @@ fn test_describe_multiple_commits() {
#[test]
fn test_multiple_message_args() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Set a description using `-m` flag
@ -632,9 +624,7 @@ fn test_multiple_message_args() {
#[test]
fn test_describe_default_description() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
test_env.add_config(r#"ui.default-description = "\n\nTESTED=TODO""#);
let workspace_path = test_env.env_root().join("repo");
@ -664,9 +654,7 @@ fn test_describe_default_description() {
#[test]
fn test_describe_author() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -855,9 +843,7 @@ fn test_describe_author() {
#[test]
fn test_describe_avoids_unc() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -875,9 +861,7 @@ fn test_describe_avoids_unc() {
#[test]
fn test_describe_with_edit_and_message_args_opens_editor() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -903,9 +887,7 @@ fn test_describe_with_edit_and_message_args_opens_editor() {
#[test]
fn test_describe_change_with_existing_message_with_edit_and_message_args_opens_editor() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
@ -932,9 +914,7 @@ fn test_describe_change_with_existing_message_with_edit_and_message_args_opens_e
#[test]
fn test_edit_cannot_be_used_with_no_edit() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&workspace_path, ["describe", "--no-edit", "--edit"]);

View file

@ -22,9 +22,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_diff_basic() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -211,7 +209,7 @@ fn test_diff_basic() {
// Unmatched paths should generate warnings
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"diff",
"-Rrepo",
@ -240,9 +238,7 @@ fn test_diff_basic() {
#[test]
fn test_diff_empty() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "").unwrap();
@ -273,9 +269,7 @@ fn test_diff_empty() {
#[test]
fn test_diff_file_mode() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Test content+mode/mode-only changes of empty/non-empty files:
@ -427,9 +421,7 @@ fn test_diff_file_mode() {
#[test]
fn test_diff_types() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let file_path = repo_path.join("foo");
@ -515,9 +507,7 @@ fn test_diff_types() {
#[test]
fn test_diff_name_only() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.run_jj_in(&repo_path, ["new"]).success();
@ -549,9 +539,7 @@ fn test_diff_name_only() {
#[test]
fn test_diff_bad_args() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "--types"]);
@ -582,9 +570,7 @@ fn test_diff_bad_args() {
#[test]
fn test_diff_relative_paths() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::create_dir_all(repo_path.join("dir1").join("subdir1")).unwrap();
@ -726,9 +712,7 @@ fn test_diff_relative_paths() {
#[test]
fn test_diff_hunks() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Test added, removed, inserted, and modified lines. The modified line
@ -823,9 +807,7 @@ fn test_diff_hunks() {
#[test]
fn test_diff_color_words_inlining_threshold() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render_diff = |max_alternation: i32, args: &[&str]| {
@ -1382,9 +1364,7 @@ fn test_diff_color_words_inlining_threshold() {
#[test]
fn test_diff_missing_newline() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo").unwrap();
@ -1441,9 +1421,7 @@ fn test_diff_missing_newline() {
#[test]
fn test_color_words_diff_missing_newline() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "").unwrap();
@ -1645,9 +1623,7 @@ fn test_color_words_diff_missing_newline() {
#[test]
fn test_diff_ignore_whitespace() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(
@ -1756,9 +1732,7 @@ fn test_diff_ignore_whitespace() {
#[test]
fn test_diff_skipped_context() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\nb\nc\nd\ne\nf\ng\nh\ni\nj").unwrap();
@ -1884,9 +1858,7 @@ fn test_diff_skipped_context() {
#[test]
fn test_diff_skipped_context_from_settings_color_words() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
@ -1930,9 +1902,7 @@ context = 0
#[test]
fn test_diff_skipped_context_from_settings_git() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
@ -1992,9 +1962,7 @@ context = 0
#[test]
fn test_diff_skipped_context_nondefault() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\nb\nc\nd").unwrap();
@ -2075,9 +2043,7 @@ fn test_diff_skipped_context_nondefault() {
#[test]
fn test_diff_leading_trailing_context() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// N=5 context lines at start/end of the file
@ -2215,9 +2181,7 @@ fn test_diff_leading_trailing_context() {
#[test]
fn test_diff_external_tool() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -2384,9 +2348,7 @@ fn test_diff_external_tool() {
#[test]
fn test_diff_external_file_by_file_tool() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "file1\n").unwrap();
@ -2504,9 +2466,7 @@ fn test_diff_external_file_by_file_tool() {
#[test]
fn test_diff_external_tool_symlink() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let external_file_path = test_env.env_root().join("external-file");
@ -2549,9 +2509,7 @@ fn test_diff_external_tool_symlink() {
#[test]
fn test_diff_external_tool_conflict_marker_style() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let file_path = repo_path.join("file");
@ -2665,9 +2623,7 @@ fn test_diff_external_tool_conflict_marker_style() {
#[test]
fn test_diff_stat() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -2702,9 +2658,7 @@ fn test_diff_stat() {
fn test_diff_stat_long_name_or_stat() {
let mut test_env = TestEnvironment::default();
test_env.add_env_var("COLUMNS", "30");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let get_stat = |test_env: &TestEnvironment, path_length: usize, stat_size: usize| {
@ -2834,9 +2788,7 @@ fn test_diff_stat_long_name_or_stat() {
#[test]
fn test_diff_binary() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1.png"), b"\x89PNG\r\n\x1a\nabcdefg\0").unwrap();

View file

@ -19,9 +19,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_diffedit() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
@ -190,9 +188,7 @@ fn test_diffedit() {
#[test]
fn test_diffedit_new_file() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
@ -264,9 +260,7 @@ fn test_diffedit_new_file() {
#[test]
fn test_diffedit_external_tool_conflict_marker_style() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let file_path = repo_path.join("file");
@ -459,9 +453,7 @@ fn test_diffedit_external_tool_conflict_marker_style() {
#[test]
fn test_diffedit_3pane() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
@ -587,9 +579,7 @@ fn test_diffedit_3pane() {
#[test]
fn test_diffedit_merge() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
@ -662,9 +652,7 @@ fn test_diffedit_merge() {
#[test]
fn test_diffedit_old_restore_interactive_tests() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
@ -768,9 +756,7 @@ fn test_diffedit_old_restore_interactive_tests() {
#[test]
fn test_diffedit_restore_descendants() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "println!(\"foo\")\n").unwrap();

View file

@ -38,9 +38,7 @@ fn create_commit(test_env: &TestEnvironment, repo_path: &Path, name: &str, paren
#[test]
fn test_duplicate() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -118,9 +116,7 @@ fn test_duplicate() {
#[test]
fn test_duplicate_many() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -289,9 +285,7 @@ fn test_duplicate_many() {
#[test]
fn test_duplicate_destination() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a1", &[]);
@ -514,9 +508,7 @@ fn test_duplicate_destination() {
#[test]
fn test_duplicate_insert_after() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a1", &[]);
@ -1212,9 +1204,7 @@ fn test_duplicate_insert_after() {
#[test]
fn test_duplicate_insert_before() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a1", &[]);
@ -1916,9 +1906,7 @@ fn test_duplicate_insert_before() {
#[test]
fn test_duplicate_insert_after_before() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a1", &[]);
@ -2582,9 +2570,7 @@ fn test_duplicate_insert_after_before() {
#[test]
fn test_undo_after_duplicate() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -2625,9 +2611,7 @@ fn test_undo_after_duplicate() {
#[test]
fn test_rebase_duplicates() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);

View file

@ -20,9 +20,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_edit() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "0").unwrap();
test_env
@ -86,9 +84,7 @@ fn test_edit_current_wc_commit_missing() {
// Test that we get a reasonable error message when the current working-copy
// commit is missing
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])

View file

@ -18,9 +18,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_evolog_with_or_without_diff() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -158,9 +156,7 @@ fn test_evolog_with_or_without_diff() {
#[test]
fn test_evolog_with_custom_symbols() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -193,9 +189,7 @@ fn test_evolog_with_custom_symbols() {
#[test]
fn test_evolog_word_wrap() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |args: &[&str], columns: u32, word_wrap: bool| {
let word_wrap = to_toml_value(word_wrap);
@ -249,9 +243,7 @@ fn test_evolog_word_wrap() {
#[test]
fn test_evolog_squash() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -363,9 +355,7 @@ fn test_evolog_squash() {
#[test]
fn test_evolog_with_no_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["evolog", "-T"]);
@ -399,9 +389,7 @@ fn test_evolog_with_no_template() {
#[test]
fn test_evolog_reversed_no_graph() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -442,9 +430,7 @@ fn test_evolog_reversed_no_graph() {
#[test]
fn test_evolog_reverse_with_graph() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env

View file

@ -28,9 +28,7 @@ fn append_to_file(file_path: &Path, contents: &str) {
#[test]
fn test_annotate_linear() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file.txt"), "line1\n").unwrap();
@ -55,9 +53,7 @@ fn test_annotate_linear() {
#[test]
fn test_annotate_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file.txt"), "line1\n").unwrap();
@ -107,9 +103,7 @@ fn test_annotate_merge() {
#[test]
fn test_annotate_conflicted() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file.txt"), "line1\n").unwrap();
@ -158,9 +152,7 @@ fn test_annotate_conflicted() {
#[test]
fn test_annotate_merge_one_sided_conflict_resolution() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file.txt"), "line1\n").unwrap();
@ -209,9 +201,7 @@ fn test_annotate_merge_one_sided_conflict_resolution() {
#[test]
fn test_annotate_with_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file.txt"), "line1\n").unwrap();

View file

@ -51,9 +51,7 @@ fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> CommandOutput
#[test]
fn test_chmod_regular_conflict() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);
@ -160,9 +158,7 @@ fn test_chmod_regular_conflict() {
#[test]
fn test_chmod_file_dir_deletion_conflicts() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);

View file

@ -17,9 +17,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_show() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
@ -111,9 +109,7 @@ fn test_show() {
#[test]
fn test_show_symlink() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\n").unwrap();

View file

@ -18,9 +18,7 @@ use crate::common::TestEnvironment;
fn test_track_untrack() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"ui.allow-init-native = true"#);
test_env
.run_jj_in(test_env.env_root(), ["init", "repo"])
.success();
test_env.run_jj_in(".", ["init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "initial").unwrap();
@ -114,9 +112,7 @@ fn test_track_untrack() {
fn test_track_untrack_sparse() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"ui.allow-init-native = true"#);
test_env
.run_jj_in(test_env.env_root(), ["init", "repo"])
.success();
test_env.run_jj_in(".", ["init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "contents").unwrap();
@ -156,9 +152,7 @@ fn test_track_untrack_sparse() {
fn test_auto_track() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"snapshot.auto-track = 'glob:*.rs'"#);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1.rs"), "initial").unwrap();
@ -216,9 +210,7 @@ fn test_auto_track() {
fn test_track_ignored() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"snapshot.auto-track = 'none()'"#);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join(".gitignore"), "*.bak\n").unwrap();

View file

@ -27,9 +27,7 @@ use crate::common::TestEnvironment;
/// flags.
fn init_with_fake_formatter(args: &[&str]) -> (TestEnvironment, PathBuf) {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -51,9 +49,7 @@ fn init_with_fake_formatter(args: &[&str]) -> (TestEnvironment, PathBuf) {
#[test]
fn test_config_no_tools() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "content\n").unwrap();
@ -76,9 +72,7 @@ fn test_config_no_tools() {
#[test]
fn test_config_multiple_tools() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -121,9 +115,7 @@ fn test_config_multiple_tools() {
#[test]
fn test_config_multiple_tools_with_same_name() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -179,9 +171,7 @@ fn test_config_multiple_tools_with_same_name() {
#[test]
fn test_config_disabled_tools() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -231,9 +221,7 @@ fn test_config_disabled_tools() {
#[test]
fn test_config_disabled_tools_warning_when_all_tools_are_disabled() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -262,9 +250,7 @@ fn test_config_disabled_tools_warning_when_all_tools_are_disabled() {
#[test]
fn test_config_tables_overlapping_patterns() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -309,9 +295,7 @@ fn test_config_tables_overlapping_patterns() {
#[test]
fn test_config_tables_all_commands_missing() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
r###"
@ -347,9 +331,7 @@ fn test_config_tables_all_commands_missing() {
#[test]
fn test_config_tables_some_commands_missing() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -389,9 +371,7 @@ fn test_config_tables_some_commands_missing() {
#[test]
fn test_config_tables_empty_patterns_list() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -424,9 +404,7 @@ fn test_config_tables_empty_patterns_list() {
#[test]
fn test_config_filesets() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -473,9 +451,7 @@ fn test_config_filesets() {
#[test]
fn test_relative_paths() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());
@ -1053,9 +1029,7 @@ fn test_stderr_failure() {
#[test]
fn test_missing_command() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(indoc! {"
[fix.tools.bad-tool]
@ -1300,9 +1274,7 @@ fn test_fix_resolve_conflict() {
#[test]
fn test_all_files() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
assert!(formatter_path.is_file());

View file

@ -27,7 +27,7 @@ fn test_generate_markdown_docs_in_docs_dir() {
let mut markdown_help = PREAMBLE.to_string();
markdown_help.push_str(
test_env
.run_jj_in(test_env.env_root(), ["util", "markdown-help"])
.run_jj_in(".", ["util", "markdown-help"])
.success()
.stdout
.raw(),

View file

@ -62,7 +62,7 @@ fn test_git_clone(subprocess: bool) {
let git_repo = git2::Repository::init(git_repo_path).unwrap();
// Clone an empty repo
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "empty"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "empty"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -75,7 +75,7 @@ fn test_git_clone(subprocess: bool) {
set_up_non_empty_git_repo(&git_repo);
// Clone with relative source path
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -102,7 +102,7 @@ fn test_git_clone(subprocess: bool) {
// Failed clone should clean up the destination directory
std::fs::create_dir(test_env.env_root().join("bad")).unwrap();
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "bad", "failed"]);
let output = test_env.run_jj_in(".", ["git", "clone", "bad", "failed"]);
// git2's internal error is slightly different
if subprocess {
insta::assert_snapshot!(output, @r#"
@ -125,7 +125,7 @@ fn test_git_clone(subprocess: bool) {
// Failed clone shouldn't remove the existing destination directory
std::fs::create_dir(test_env.env_root().join("failed")).unwrap();
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "bad", "failed"]);
let output = test_env.run_jj_in(".", ["git", "clone", "bad", "failed"]);
// git2's internal error is slightly different
if subprocess {
insta::assert_snapshot!(output, @r#"
@ -148,7 +148,7 @@ fn test_git_clone(subprocess: bool) {
assert!(!test_env.env_root().join("failed").join(".jj").exists());
// Failed clone (if attempted) shouldn't remove the existing workspace
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "bad", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "bad", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -160,7 +160,7 @@ fn test_git_clone(subprocess: bool) {
assert!(test_env.env_root().join("clone").join(".jj").exists());
// Try cloning into an existing workspace
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -172,7 +172,7 @@ fn test_git_clone(subprocess: bool) {
// Try cloning into an existing file
std::fs::write(test_env.env_root().join("file"), "contents").unwrap();
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "file"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "file"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -184,7 +184,7 @@ fn test_git_clone(subprocess: bool) {
// Try cloning into non-empty, non-workspace directory
std::fs::remove_dir_all(test_env.env_root().join("clone").join(".jj")).unwrap();
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -195,10 +195,7 @@ fn test_git_clone(subprocess: bool) {
}
// Clone into a nested path
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "source", "nested/path/to/repo"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "nested/path/to/repo"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -221,7 +218,7 @@ fn test_git_clone_bad_source(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "", "dest"]);
let output = test_env.run_jj_in(".", ["git", "clone", "", "dest"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -233,7 +230,7 @@ fn test_git_clone_bad_source(subprocess: bool) {
// Invalid port number
let output = test_env.run_jj_in(
test_env.env_root(),
".",
["git", "clone", "https://example.net:bad-port/bar", "dest"],
);
insta::allow_duplicates! {
@ -259,10 +256,7 @@ fn test_git_clone_colocate(subprocess: bool) {
let git_repo = git2::Repository::init(git_repo_path).unwrap();
// Clone an empty repo
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "source", "empty", "--colocate"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "empty", "--colocate"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -286,10 +280,7 @@ fn test_git_clone_colocate(subprocess: bool) {
set_up_non_empty_git_repo(&git_repo);
// Clone with relative source path
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "source", "clone", "--colocate"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone", "--colocate"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -361,10 +352,7 @@ fn test_git_clone_colocate(subprocess: bool) {
// Failed clone should clean up the destination directory
std::fs::create_dir(test_env.env_root().join("bad")).unwrap();
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "--colocate", "bad", "failed"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "--colocate", "bad", "failed"]);
// git2's internal error is slightly different
if subprocess {
insta::assert_snapshot!(output, @r#"
@ -387,10 +375,7 @@ fn test_git_clone_colocate(subprocess: bool) {
// Failed clone shouldn't remove the existing destination directory
std::fs::create_dir(test_env.env_root().join("failed")).unwrap();
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "--colocate", "bad", "failed"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "--colocate", "bad", "failed"]);
// git2's internal error is slightly different
if subprocess {
insta::assert_snapshot!(output, @r#"
@ -414,10 +399,7 @@ fn test_git_clone_colocate(subprocess: bool) {
assert!(!test_env.env_root().join("failed").join(".jj").exists());
// Failed clone (if attempted) shouldn't remove the existing workspace
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "--colocate", "bad", "clone"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "--colocate", "bad", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -430,10 +412,7 @@ fn test_git_clone_colocate(subprocess: bool) {
assert!(test_env.env_root().join("clone").join(".jj").exists());
// Try cloning into an existing workspace
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "source", "clone", "--colocate"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone", "--colocate"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -445,10 +424,7 @@ fn test_git_clone_colocate(subprocess: bool) {
// Try cloning into an existing file
std::fs::write(test_env.env_root().join("file"), "contents").unwrap();
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "source", "file", "--colocate"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "file", "--colocate"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -460,10 +436,7 @@ fn test_git_clone_colocate(subprocess: bool) {
// Try cloning into non-empty, non-workspace directory
std::fs::remove_dir_all(test_env.env_root().join("clone").join(".jj")).unwrap();
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "source", "clone", "--colocate"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone", "--colocate"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -475,7 +448,7 @@ fn test_git_clone_colocate(subprocess: bool) {
// Clone into a nested path
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"git",
"clone",
@ -520,7 +493,7 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) {
// All fetched bookmarks will be imported if auto-local-bookmark is on
test_env.add_config("git.auto-local-bookmark = true");
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone1"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone1"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -559,7 +532,7 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) {
// Only the default bookmark will be imported if auto-local-bookmark is off
test_env.add_config("git.auto-local-bookmark = false");
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone2"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone2"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -585,7 +558,7 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) {
// Change the default bookmark in remote
git_repo.set_head("refs/heads/feature1").unwrap();
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone3"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone3"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -642,7 +615,7 @@ fn test_git_clone_remote_default_bookmark_with_escape(subprocess: bool) {
.rename("refs/heads/\"", false, "")
.unwrap();
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -682,7 +655,7 @@ fn test_git_clone_ignore_working_copy(subprocess: bool) {
// Should not update working-copy files
let output = test_env.run_jj_in(
test_env.env_root(),
".",
["git", "clone", "--ignore-working-copy", "source", "clone"],
);
insta::allow_duplicates! {
@ -731,10 +704,7 @@ fn test_git_clone_at_operation(subprocess: bool) {
let git_repo = git2::Repository::init(git_repo_path).unwrap();
set_up_non_empty_git_repo(&git_repo);
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "--at-op=@-", "source", "clone"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "--at-op=@-", "source", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -759,7 +729,7 @@ fn test_git_clone_with_remote_name(subprocess: bool) {
// Clone with relative source path and a non-default remote name
let output = test_env.run_jj_in(
test_env.env_root(),
".",
["git", "clone", "source", "clone", "--remote", "upstream"],
);
insta::allow_duplicates! {
@ -786,10 +756,7 @@ fn test_git_clone_with_remote_named_git(subprocess: bool) {
let git_repo_path = test_env.env_root().join("source");
git2::Repository::init(git_repo_path).unwrap();
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "--remote=git", "source", "dest"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "--remote=git", "source", "dest"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r"
------- stderr -------
@ -811,7 +778,7 @@ fn test_git_clone_with_remote_with_slashes(subprocess: bool) {
git2::Repository::init(git_repo_path).unwrap();
let output = test_env.run_jj_in(
test_env.env_root(),
".",
["git", "clone", "--remote=slash/origin", "source", "dest"],
);
insta::allow_duplicates! {
@ -836,7 +803,7 @@ fn test_git_clone_trunk_deleted(subprocess: bool) {
set_up_non_empty_git_repo(&git_repo);
let clone_path = test_env.env_root().join("clone");
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -982,10 +949,7 @@ fn test_git_clone_with_depth_git2() {
// (we cannot replicate git2's erroneous behaviour wrt git)
// local transport does not support shallow clones so we just test that the
// depth arg is passed on here
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "--depth", "1", "source", "clone"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "--depth", "1", "source", "clone"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Fetching into new repo in "$TEST_ENV/clone"
@ -1006,10 +970,7 @@ fn test_git_clone_with_depth_subprocess() {
// git does support shallow clones on the local transport, so it will work
// (we cannot replicate git2's erroneous behaviour wrt git)
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "clone", "--depth", "1", "source", "clone"],
);
let output = test_env.run_jj_in(".", ["git", "clone", "--depth", "1", "source", "clone"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Fetching into new repo in "$TEST_ENV/clone"
@ -1049,7 +1010,7 @@ fn test_git_clone_invalid_immutable_heads(subprocess: bool) {
// The error shouldn't be counted as an immutable working-copy commit. It
// should be reported.
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -1079,7 +1040,7 @@ fn test_git_clone_malformed(subprocess: bool) {
set_up_git_repo_with_file(&git_repo, ".jj");
// TODO: Perhaps, this should be a user error, not an internal error.
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -1141,7 +1102,7 @@ fn test_git_clone_no_git_executable() {
let git_repo = git2::Repository::init(git_repo_path).unwrap();
set_up_non_empty_git_repo(&git_repo);
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone"]);
insta::assert_snapshot!(output.strip_stderr_last_line(), @r#"
------- stderr -------
Fetching into new repo in "$TEST_ENV/clone"
@ -1163,7 +1124,7 @@ fn test_git_clone_no_git_executable_with_path() {
let git_repo = git2::Repository::init(git_repo_path).unwrap();
set_up_non_empty_git_repo(&git_repo);
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "clone"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "clone"]);
insta::assert_snapshot!(output.strip_stderr_last_line(), @r#"
------- stderr -------
Fetching into new repo in "$TEST_ENV/clone"

View file

@ -459,7 +459,7 @@ fn test_git_colocated_bookmark_forget() {
fn test_git_colocated_bookmark_at_root() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "--colocate", "repo"])
.run_jj_in(".", ["git", "init", "--colocate", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -908,7 +908,7 @@ fn test_git_colocated_undo_head_move() {
fn test_git_colocated_update_index_preserves_timestamps() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "--colocate", "repo"])
.run_jj_in(".", ["git", "init", "--colocate", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -999,7 +999,7 @@ fn test_git_colocated_update_index_preserves_timestamps() {
fn test_git_colocated_update_index_merge_conflict() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "--colocate", "repo"])
.run_jj_in(".", ["git", "init", "--colocate", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -1093,7 +1093,7 @@ fn test_git_colocated_update_index_merge_conflict() {
fn test_git_colocated_update_index_rebase_conflict() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "--colocate", "repo"])
.run_jj_in(".", ["git", "init", "--colocate", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -1190,7 +1190,7 @@ fn test_git_colocated_update_index_rebase_conflict() {
fn test_git_colocated_update_index_3_sided_conflict() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "--colocate", "repo"])
.run_jj_in(".", ["git", "init", "--colocate", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");

View file

@ -131,9 +131,7 @@ fn test_git_fetch_with_default_config(subprocess: bool) {
if !subprocess {
test_env.add_config("git.subprocess = false");
}
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "origin");
@ -154,9 +152,7 @@ fn test_git_fetch_default_remote(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "origin");
@ -178,9 +174,7 @@ fn test_git_fetch_single_remote(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
@ -210,9 +204,7 @@ fn test_git_fetch_single_remote_all_remotes_flag(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
@ -236,9 +228,7 @@ fn test_git_fetch_single_remote_from_arg(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
@ -262,9 +252,7 @@ fn test_git_fetch_single_remote_from_config(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
test_env.add_config(r#"git.fetch = "rem1""#);
@ -287,9 +275,7 @@ fn test_git_fetch_multiple_remotes(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
add_git_remote(&test_env, &repo_path, "rem2");
@ -319,9 +305,7 @@ fn test_git_fetch_all_remotes(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
add_git_remote(&test_env, &repo_path, "rem2");
@ -356,9 +340,7 @@ fn test_git_fetch_multiple_remotes_from_config(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
add_git_remote(&test_env, &repo_path, "rem2");
@ -383,9 +365,7 @@ fn test_git_fetch_nonexistent_remote(subprocess: bool) {
if !subprocess {
test_env.add_config("git.subprocess = false");
}
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
@ -414,9 +394,7 @@ fn test_git_fetch_nonexistent_remote_from_config(subprocess: bool) {
if !subprocess {
test_env.add_config("git.subprocess = false");
}
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
test_env.add_config(r#"git.fetch = ["rem1", "rem2"]"#);
@ -545,9 +523,7 @@ fn test_git_fetch_prune_before_updating_tips(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let git_repo = add_git_remote(&test_env, &repo_path, "origin");
test_env.run_jj_in(&repo_path, ["git", "fetch"]).success();
@ -584,9 +560,7 @@ fn test_git_fetch_conflicting_bookmarks(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "rem1");
@ -718,7 +692,7 @@ fn test_git_fetch_all(subprocess: bool) {
let _git_repo = git2::Repository::init(source_git_repo_path.clone()).unwrap();
// Clone an empty repo. The target repo is a normal `jj` repo, *not* colocated
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "target"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "target"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -910,7 +884,7 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) {
let _git_repo = git2::Repository::init(source_git_repo_path.clone()).unwrap();
// Clone an empty repo. The target repo is a normal `jj` repo, *not* colocated
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "target"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "target"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -1188,9 +1162,7 @@ fn test_git_fetch_bookmarks_some_missing(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "origin");
add_git_remote(&test_env, &repo_path, "rem1");
@ -1313,9 +1285,7 @@ fn test_git_fetch_bookmarks_some_missing(subprocess: bool) {
#[test]
fn test_git_fetch_bookmarks_missing_with_subprocess_localized_message() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "origin");
@ -1354,7 +1324,7 @@ fn test_git_fetch_undo(subprocess: bool) {
let _git_repo = git2::Repository::init(source_git_repo_path.clone()).unwrap();
// Clone an empty repo. The target repo is a normal `jj` repo, *not* colocated
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "target"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "target"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -1457,7 +1427,7 @@ fn test_fetch_undo_what(subprocess: bool) {
let _git_repo = git2::Repository::init(source_git_repo_path.clone()).unwrap();
// Clone an empty repo. The target repo is a normal `jj` repo, *not* colocated
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "target"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "target"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -1587,9 +1557,7 @@ fn test_git_fetch_remove_fetch(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "origin");
@ -1658,9 +1626,7 @@ fn test_git_fetch_rename_fetch(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
add_git_remote(&test_env, &repo_path, "origin");
@ -1724,7 +1690,7 @@ fn test_git_fetch_removed_bookmark(subprocess: bool) {
let _git_repo = git2::Repository::init(source_git_repo_path.clone()).unwrap();
// Clone an empty repo. The target repo is a normal `jj` repo, *not* colocated
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "target"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "target"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -1846,7 +1812,7 @@ fn test_git_fetch_removed_parent_bookmark(subprocess: bool) {
let _git_repo = git2::Repository::init(source_git_repo_path.clone()).unwrap();
// Clone an empty repo. The target repo is a normal `jj` repo, *not* colocated
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "source", "target"]);
let output = test_env.run_jj_in(".", ["git", "clone", "source", "target"]);
insta::allow_duplicates! {
insta::assert_snapshot!(output, @r#"
------- stderr -------
@ -1948,9 +1914,7 @@ fn test_git_fetch_remote_only_bookmark(subprocess: bool) {
if !subprocess {
test_env.add_config("git.subprocess = false");
}
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create non-empty git repo to add as a remote
@ -2038,9 +2002,7 @@ fn test_git_fetch_preserve_commits_across_repos(subprocess: bool) {
test_env.add_config("git.subprocess = false");
}
test_env.add_config("git.auto-local-bookmark = true");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let upstream_repo = add_git_remote(&test_env, &repo_path, "upstream");

View file

@ -23,9 +23,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_resolution_of_git_tracking_bookmarks() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["bookmark", "create", "-r@", "main"])
@ -70,9 +68,7 @@ fn test_resolution_of_git_tracking_bookmarks() {
#[test]
fn test_git_export_conflicting_git_refs() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -98,9 +94,7 @@ fn test_git_export_conflicting_git_refs() {
#[test]
fn test_git_export_undo() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let git_repo = git::open(repo_path.join(".jj/repo/store/git"));
@ -160,9 +154,7 @@ fn test_git_export_undo() {
#[test]
fn test_git_import_undo() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let git_repo = git::open(repo_path.join(".jj/repo/store/git"));
@ -223,9 +215,7 @@ fn test_git_import_undo() {
#[test]
fn test_git_import_move_export_with_default_undo() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let git_repo = git::open(repo_path.join(".jj/repo/store/git"));

View file

@ -68,7 +68,7 @@ fn read_git_target(workspace_root: &Path) -> String {
#[test]
fn test_git_init_internal() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(test_env.env_root(), ["git", "init", "repo"]);
let output = test_env.run_jj_in(".", ["git", "init", "repo"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Initialized repo in "repo"
@ -127,7 +127,7 @@ fn test_git_init_external(bare: bool) {
init_git_repo(&git_repo_path, bare);
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"git",
"init",
@ -204,7 +204,7 @@ fn test_git_init_external_import_trunk(bare: bool) {
);
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"git",
"init",
@ -296,10 +296,7 @@ fn test_git_init_external_at_operation() {
#[test]
fn test_git_init_external_non_existent_directory() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "init", "repo", "--git-repo", "non-existent"],
);
let output = test_env.run_jj_in(".", ["git", "init", "repo", "--git-repo", "non-existent"]);
insta::assert_snapshot!(output.strip_stderr_last_line(), @r"
------- stderr -------
Error: Failed to access the repository
@ -314,10 +311,7 @@ fn test_git_init_external_non_existent_directory() {
fn test_git_init_external_non_existent_git_directory() {
let test_env = TestEnvironment::default();
let workspace_root = test_env.env_root().join("repo");
let output = test_env.run_jj_in(
test_env.env_root(),
["git", "init", "repo", "--git-repo", "repo"],
);
let output = test_env.run_jj_in(".", ["git", "init", "repo", "--git-repo", "repo"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Error: Failed to access the repository
@ -543,9 +537,7 @@ fn test_git_init_colocated_via_git_repo_path_imported_refs() {
test_env.add_config("git.auto-local-bookmark = true");
// Set up remote refs
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "remote"])
.success();
test_env.run_jj_in(".", ["git", "init", "remote"]).success();
let remote_path = test_env.env_root().join("remote");
test_env
.run_jj_in(
@ -796,7 +788,7 @@ 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 output = test_env.run_jj_in(test_env.env_root(), ["git", "init", "--colocate", "repo"]);
let output = test_env.run_jj_in(".", ["git", "init", "--colocate", "repo"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Done importing changes from the underlying Git repo.
@ -827,7 +819,7 @@ fn test_git_init_colocated_via_flag_git_dir_exists() {
fn test_git_init_colocated_via_flag_git_dir_not_exists() {
let test_env = TestEnvironment::default();
let workspace_root = test_env.env_root().join("repo");
let output = test_env.run_jj_in(test_env.env_root(), ["git", "init", "--colocate", "repo"]);
let output = test_env.run_jj_in(".", ["git", "init", "--colocate", "repo"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Initialized repo in "repo"
@ -933,7 +925,7 @@ fn test_git_init_conditional_config() {
fn test_git_init_bad_wc_path() {
let test_env = TestEnvironment::default();
std::fs::write(test_env.env_root().join("existing-file"), b"").unwrap();
let output = test_env.run_jj_in(test_env.env_root(), ["git", "init", "existing-file"]);
let output = test_env.run_jj_in(".", ["git", "init", "existing-file"]);
insta::assert_snapshot!(output.strip_stderr_last_line(), @r"
------- stderr -------
Error: Failed to create workspace

View file

@ -19,9 +19,7 @@ use crate::common::TestEnvironment;
fn set_up() -> (TestEnvironment, PathBuf) {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "origin"])
.success();
test_env.run_jj_in(".", ["git", "init", "origin"]).success();
let origin_path = test_env.env_root().join("origin");
let origin_git_repo_path = origin_path
.join(".jj")
@ -44,7 +42,7 @@ fn set_up() -> (TestEnvironment, PathBuf) {
test_env
.run_jj_in(
test_env.env_root(),
".",
[
"git",
"clone",
@ -61,7 +59,7 @@ fn set_up() -> (TestEnvironment, PathBuf) {
fn set_up_remote_at_main(test_env: &TestEnvironment, workspace_root: &Path, remote_name: &str) {
test_env
.run_jj_in(test_env.env_root(), ["git", "init", remote_name])
.run_jj_in(".", ["git", "init", remote_name])
.success();
let other_path = test_env.env_root().join(remote_name);
let other_git_repo_path = other_path

View file

@ -22,9 +22,7 @@ use crate::common::TestEnvironment;
fn set_up() -> (TestEnvironment, PathBuf) {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "origin"])
.success();
test_env.run_jj_in(".", ["git", "init", "origin"]).success();
let origin_path = test_env.env_root().join("origin");
let origin_git_repo_path = origin_path
.join(".jj")
@ -50,7 +48,7 @@ fn set_up() -> (TestEnvironment, PathBuf) {
test_env
.run_jj_in(
test_env.env_root(),
".",
[
"git",
"clone",

View file

@ -21,9 +21,7 @@ use crate::common::TestEnvironment;
fn test_git_remotes() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
@ -64,9 +62,7 @@ fn test_git_remotes() {
fn test_git_remote_add() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(
@ -111,9 +107,7 @@ fn test_git_remote_add() {
fn test_git_remote_set_url() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(
@ -174,9 +168,7 @@ fn test_git_remote_set_url() {
#[test]
fn test_git_remote_relative_path() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Relative path using OS-native separator
@ -196,7 +188,7 @@ fn test_git_remote_relative_path() {
// Relative path using UNIX separator
test_env
.run_jj_in(
test_env.env_root(),
".",
["-Rrepo", "git", "remote", "set-url", "foo", "unix/sep"],
)
.success();
@ -211,9 +203,7 @@ fn test_git_remote_relative_path() {
fn test_git_remote_rename() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(

View file

@ -74,7 +74,7 @@ fn test_gitignores_relative_excludes_file_path() {
let test_env = TestEnvironment::default();
let workspace_root = test_env.env_root().join("repo");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "--colocate", "repo"])
.run_jj_in(".", ["git", "init", "--colocate", "repo"])
.success();
let mut file = std::fs::OpenOptions::new()
@ -97,7 +97,7 @@ fn test_gitignores_relative_excludes_file_path() {
A ../not-ignored
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["-Rrepo", "diff", "-s"]);
let output = test_env.run_jj_in(".", ["-Rrepo", "diff", "-s"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
A repo/not-ignored
[EOF]

View file

@ -34,7 +34,7 @@ fn test_non_utf8_arg() {
use std::os::windows::prelude::*;
OsString::from_wide(&[0x0066, 0x006f, 0xD800, 0x006f])
};
let output = test_env.run_jj_in(test_env.env_root(), [&invalid_utf]);
let output = test_env.run_jj_in(".", [&invalid_utf]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Error: Non-utf8 argument
@ -47,9 +47,7 @@ fn test_non_utf8_arg() {
fn test_version() {
let test_env = TestEnvironment::default();
let output = test_env
.run_jj_in(test_env.env_root(), ["--version"])
.success();
let output = test_env.run_jj_in(".", ["--version"]).success();
let stdout = output.stdout.into_raw();
let sanitized = stdout.replace(|c: char| c.is_ascii_hexdigit(), "?");
let expected = [
@ -65,13 +63,11 @@ fn test_version() {
#[test]
fn test_no_subcommand() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Outside of a repo.
let output = test_env.run_jj_in(test_env.env_root(), [""; 0]);
let output = test_env.run_jj_in(".", [""; 0]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Hint: Use `jj -h` for a list of available commands.
@ -82,7 +78,7 @@ fn test_no_subcommand() {
"#);
test_env.add_config(r#"ui.default-command="log""#);
let output = test_env.run_jj_in(test_env.env_root(), [""; 0]);
let output = test_env.run_jj_in(".", [""; 0]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Error: There is no jj repo in "."
@ -90,17 +86,13 @@ fn test_no_subcommand() {
[exit status: 1]
"#);
let output = test_env
.run_jj_in(test_env.env_root(), ["--help"])
.success();
let output = test_env.run_jj_in(".", ["--help"]).success();
insta::assert_snapshot!(
output.stdout.normalized().lines().next().unwrap(),
@"Jujutsu (An experimental VCS)");
insta::assert_snapshot!(output.stderr, @"");
let output = test_env
.run_jj_in(test_env.env_root(), ["-R", "repo"])
.success();
let output = test_env.run_jj_in(".", ["-R", "repo"]).success();
assert_eq!(output, test_env.run_jj_in(&repo_path, ["log"]));
// Inside of a repo.
@ -147,9 +139,7 @@ fn test_no_subcommand() {
#[test]
fn test_ignore_working_copy() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
@ -182,7 +172,7 @@ fn test_ignore_working_copy() {
#[test]
fn test_repo_arg_with_init() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(test_env.env_root(), ["init", "-R=.", "repo"]);
let output = test_env.run_jj_in(".", ["init", "-R=.", "repo"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Error: There is no jj repo in "."
@ -194,7 +184,7 @@ fn test_repo_arg_with_init() {
#[test]
fn test_repo_arg_with_git_clone() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(test_env.env_root(), ["git", "clone", "-R=.", "remote"]);
let output = test_env.run_jj_in(".", ["git", "clone", "-R=.", "remote"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Error: There is no jj repo in "."
@ -206,9 +196,7 @@ fn test_repo_arg_with_git_clone() {
#[test]
fn test_resolve_workspace_directory() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let subdir = repo_path.join("dir").join("subdir");
std::fs::create_dir_all(&subdir).unwrap();
@ -264,7 +252,7 @@ fn test_no_workspace_directory() {
[exit status: 1]
"#);
let output = test_env.run_jj_in(test_env.env_root(), ["status", "-R", "repo"]);
let output = test_env.run_jj_in(".", ["status", "-R", "repo"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Error: There is no jj repo in "repo"
@ -287,9 +275,7 @@ fn test_no_workspace_directory() {
#[test]
fn test_bad_path() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let subdir = repo_path.join("dir");
std::fs::create_dir_all(&subdir).unwrap();
@ -331,7 +317,7 @@ fn test_bad_path() {
"#);
// cwd != workspace_root, can be parsed as repo-relative path
let output = test_env.run_jj_in(test_env.env_root(), ["file", "show", "-Rrepo", "out"]);
let output = test_env.run_jj_in(".", ["file", "show", "-Rrepo", "out"]);
insta::assert_snapshot!(output.normalize_backslash(), @r#"
------- stderr -------
Error: Failed to parse fileset: Invalid file pattern
@ -353,9 +339,7 @@ fn test_bad_path() {
#[test]
fn test_invalid_filesets_looking_like_filepaths() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "abc~"]);
@ -377,9 +361,7 @@ fn test_invalid_filesets_looking_like_filepaths() {
#[test]
fn test_broken_repo_structure() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let store_path = repo_path.join(".jj").join("repo").join("store");
let store_type_path = store_path.join("type");
@ -442,9 +424,7 @@ fn test_broken_repo_structure() {
fn test_color_config() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Test that --color=always is respected.
@ -558,14 +538,12 @@ fn test_color_config() {
#[test]
fn test_color_ui_messages() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config("ui.color = 'always'");
// hint and error
let output = test_env.run_jj_in(test_env.env_root(), ["-R."]);
let output = test_env.run_jj_in(".", ["-R."]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Hint: Use `jj -h` for a list of available commands.
@ -645,9 +623,7 @@ fn test_color_ui_messages() {
#[test]
fn test_quiet() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Can skip message about new working copy with `--quiet`
@ -662,14 +638,14 @@ fn test_early_args() {
let test_env = TestEnvironment::default();
// The default is no color.
let output = test_env.run_jj_in(test_env.env_root(), ["help"]).success();
let output = test_env.run_jj_in(".", ["help"]).success();
insta::assert_snapshot!(
output.stdout.normalized().lines().find(|l| l.contains("Commands:")).unwrap(),
@"Commands:");
// Check that output is colorized.
let output = test_env
.run_jj_in(test_env.env_root(), ["--color=always", "help"])
.run_jj_in(".", ["--color=always", "help"])
.success();
insta::assert_snapshot!(
output.stdout.normalized().lines().find(|l| l.contains("Commands:")).unwrap(),
@ -677,21 +653,19 @@ fn test_early_args() {
// Check that early args are accepted after the help command
let output = test_env
.run_jj_in(test_env.env_root(), ["help", "--color=always"])
.run_jj_in(".", ["help", "--color=always"])
.success();
insta::assert_snapshot!(
output.stdout.normalized().lines().find(|l| l.contains("Commands:")).unwrap(),
@"Commands:");
// Check that early args are accepted after -h/--help
let output = test_env
.run_jj_in(test_env.env_root(), ["-h", "--color=always"])
.success();
let output = test_env.run_jj_in(".", ["-h", "--color=always"]).success();
insta::assert_snapshot!(
output.stdout.normalized().lines().find(|l| l.contains("Usage:")).unwrap(),
@"Usage: jj [OPTIONS] <COMMAND>");
let output = test_env
.run_jj_in(test_env.env_root(), ["log", "--help", "--color=always"])
.run_jj_in(".", ["log", "--help", "--color=always"])
.success();
insta::assert_snapshot!(
output.stdout.normalized().lines().find(|l| l.contains("Usage:")).unwrap(),
@ -700,11 +674,9 @@ fn test_early_args() {
// Early args are parsed with clap's ignore_errors(), but there is a known
// bug that causes defaults to be unpopulated. Test that the early args are
// tolerant of this bug and don't cause a crash.
test_env.run_jj_in(".", ["--no-pager", "help"]).success();
test_env
.run_jj_in(test_env.env_root(), ["--no-pager", "help"])
.success();
test_env
.run_jj_in(test_env.env_root(), ["--config=ui.color=always", "help"])
.run_jj_in(".", ["--config=ui.color=always", "help"])
.success();
}
@ -713,7 +685,7 @@ fn test_config_args() {
let test_env = TestEnvironment::default();
let list_config = |args: &[&str]| {
test_env.run_jj_in(
test_env.env_root(),
".",
[&["config", "list", "--include-overridden", "test"], args].concat(),
)
};
@ -785,10 +757,7 @@ fn test_config_args() {
[EOF]
"##);
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "list", "foo", "--config-toml=foo='bar'"],
);
let output = test_env.run_jj_in(".", ["config", "list", "foo", "--config-toml=foo='bar'"]);
insta::assert_snapshot!(output, @r"
foo = 'bar'
[EOF]
@ -797,7 +766,7 @@ fn test_config_args() {
[EOF]
");
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "--config=foo"]);
let output = test_env.run_jj_in(".", ["config", "list", "--config=foo"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Config error: --config must be specified as NAME=VALUE
@ -806,10 +775,7 @@ fn test_config_args() {
[exit status: 1]
");
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "list", "--config-file=unknown.toml"],
);
let output = test_env.run_jj_in(".", ["config", "list", "--config-file=unknown.toml"]);
insta::with_settings!({
filters => [("(?m)^([2-9]): .*", "$1: <redacted>")],
}, {
@ -832,7 +798,7 @@ fn test_invalid_config() {
let test_env = TestEnvironment::default();
test_env.add_config("[section]key = value-missing-quotes");
let output = test_env.run_jj_in(test_env.env_root(), ["init", "repo"]);
let output = test_env.run_jj_in(".", ["init", "repo"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Config error: Configuration cannot be parsed as TOML document
@ -854,9 +820,7 @@ fn test_invalid_config() {
fn test_invalid_config_value() {
// Test that we get a reasonable error if a config value is invalid
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["status", "--config=snapshot.auto-track=[0]"]);
@ -892,10 +856,7 @@ fn test_conditional_config() {
"});
// Sanity check
let output = test_env.run_jj_in(
test_env.env_root(),
["config", "list", "--include-overridden", "aliases"],
);
let output = test_env.run_jj_in(".", ["config", "list", "--include-overridden", "aliases"]);
insta::assert_snapshot!(output, @r"
aliases.foo = ['new', 'root()', '-mglobal']
[EOF]
@ -1050,9 +1011,7 @@ fn test_default_config() {
fn test_no_user_configured() {
// Test that the user is reminded if they haven't configured their name or email
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_with(|cmd| {
@ -1103,7 +1062,7 @@ fn test_help() {
// Test that global options are separated out in the help output
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(test_env.env_root(), ["diffedit", "-h"]);
let output = test_env.run_jj_in(".", ["diffedit", "-h"]);
insta::assert_snapshot!(output, @r"
Touch up the content changes in a revision with a diff editor
@ -1138,9 +1097,7 @@ fn test_debug_logging_enabled() {
// Test that the debug flag enabled debug logging
let test_env = TestEnvironment::default();
let output = test_env
.run_jj_in(test_env.env_root(), ["version", "--debug"])
.success();
let output = test_env.run_jj_in(".", ["version", "--debug"]).success();
// Split the first log line into a timestamp and the rest.
// The timestamp is constant sized so this is a robust operation.
// Example timestamp: 2022-11-20T06:24:05.477703Z

View file

@ -18,27 +18,25 @@ use crate::common::TestEnvironment;
fn test_help() {
let test_env = TestEnvironment::default();
let help_cmd = test_env.run_jj_in(test_env.env_root(), ["help"]).success();
let help_cmd = test_env.run_jj_in(".", ["help"]).success();
// The help command output should be equal to the long --help flag
let help_flag = test_env.run_jj_in(test_env.env_root(), ["--help"]);
let help_flag = test_env.run_jj_in(".", ["--help"]);
assert_eq!(help_cmd, help_flag);
// Help command should work with commands
let help_cmd = test_env
.run_jj_in(test_env.env_root(), ["help", "log"])
.success();
let help_flag = test_env.run_jj_in(test_env.env_root(), ["log", "--help"]);
let help_cmd = test_env.run_jj_in(".", ["help", "log"]).success();
let help_flag = test_env.run_jj_in(".", ["log", "--help"]);
assert_eq!(help_cmd, help_flag);
// Help command should work with subcommands
let help_cmd = test_env
.run_jj_in(test_env.env_root(), ["help", "workspace", "root"])
.run_jj_in(".", ["help", "workspace", "root"])
.success();
let help_flag = test_env.run_jj_in(test_env.env_root(), ["workspace", "root", "--help"]);
let help_flag = test_env.run_jj_in(".", ["workspace", "root", "--help"]);
assert_eq!(help_cmd, help_flag);
// Help command should not work recursively
let output = test_env.run_jj_in(test_env.env_root(), ["workspace", "help", "root"]);
let output = test_env.run_jj_in(".", ["workspace", "help", "root"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: unrecognized subcommand 'help'
@ -50,7 +48,7 @@ fn test_help() {
[exit status: 2]
");
let output = test_env.run_jj_in(test_env.env_root(), ["workspace", "add", "help"]);
let output = test_env.run_jj_in(".", ["workspace", "add", "help"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Error: There is no jj repo in "."
@ -58,7 +56,7 @@ fn test_help() {
[exit status: 1]
"#);
let output = test_env.run_jj_in(test_env.env_root(), ["new", "help", "main"]);
let output = test_env.run_jj_in(".", ["new", "help", "main"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Error: There is no jj repo in "."
@ -67,19 +65,17 @@ fn test_help() {
"#);
// Help command should output the same as --help for nonexistent commands
let help_cmd = test_env.run_jj_in(test_env.env_root(), ["help", "nonexistent"]);
let help_flag = test_env.run_jj_in(test_env.env_root(), ["nonexistent", "--help"]);
let help_cmd = test_env.run_jj_in(".", ["help", "nonexistent"]);
let help_flag = test_env.run_jj_in(".", ["nonexistent", "--help"]);
assert_eq!(help_cmd.status.code(), Some(2), "{help_cmd}");
assert_eq!(help_cmd, help_flag);
// Some edge cases
let help_cmd = test_env
.run_jj_in(test_env.env_root(), ["help", "help"])
.success();
let help_flag = test_env.run_jj_in(test_env.env_root(), ["help", "--help"]);
let help_cmd = test_env.run_jj_in(".", ["help", "help"]).success();
let help_flag = test_env.run_jj_in(".", ["help", "--help"]);
assert_eq!(help_cmd, help_flag);
let output = test_env.run_jj_in(test_env.env_root(), ["help", "unknown"]);
let output = test_env.run_jj_in(".", ["help", "unknown"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: unrecognized subcommand 'unknown'
@ -93,7 +89,7 @@ fn test_help() {
[exit status: 2]
");
let output = test_env.run_jj_in(test_env.env_root(), ["help", "log", "--", "-r"]);
let output = test_env.run_jj_in(".", ["help", "log", "--", "-r"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: a value is required for '--revisions <REVSETS>' but none was supplied
@ -110,20 +106,18 @@ fn test_help_keyword() {
// It should show help for a certain keyword if the `--keyword` flag is present
let help_cmd = test_env
.run_jj_in(test_env.env_root(), ["help", "--keyword", "revsets"])
.run_jj_in(".", ["help", "--keyword", "revsets"])
.success();
// It should be equal to the docs
assert_eq!(help_cmd.stdout.raw(), include_str!("../../docs/revsets.md"));
// It should show help for a certain keyword if the `-k` flag is present
let help_cmd = test_env
.run_jj_in(test_env.env_root(), ["help", "-k", "revsets"])
.success();
let help_cmd = test_env.run_jj_in(".", ["help", "-k", "revsets"]).success();
// It should be equal to the docs
assert_eq!(help_cmd.stdout.raw(), include_str!("../../docs/revsets.md"));
// It should give hints if a similar keyword is present
let output = test_env.run_jj_in(test_env.env_root(), ["help", "-k", "rev"]);
let output = test_env.run_jj_in(".", ["help", "-k", "rev"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: invalid value 'rev' for '--keyword <KEYWORD>'
@ -137,7 +131,7 @@ fn test_help_keyword() {
");
// It should give error with a hint if no similar keyword is found
let output = test_env.run_jj_in(test_env.env_root(), ["help", "-k", "<no-similar-keyword>"]);
let output = test_env.run_jj_in(".", ["help", "-k", "<no-similar-keyword>"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: invalid value '<no-similar-keyword>' for '--keyword <KEYWORD>'
@ -149,7 +143,7 @@ fn test_help_keyword() {
");
// The keyword flag with no argument should error with a hint
let output = test_env.run_jj_in(test_env.env_root(), ["help", "-k"]);
let output = test_env.run_jj_in(".", ["help", "-k"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: a value is required for '--keyword <KEYWORD>' but none was supplied
@ -162,7 +156,7 @@ fn test_help_keyword() {
// It shouldn't show help for a certain keyword if the `--keyword` is not
// present
let output = test_env.run_jj_in(test_env.env_root(), ["help", "revsets"]);
let output = test_env.run_jj_in(".", ["help", "revsets"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
error: unrecognized subcommand 'revsets'

View file

@ -17,9 +17,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_rewrite_immutable_generic() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "a").unwrap();
test_env
@ -145,17 +143,13 @@ fn test_rewrite_immutable_generic() {
#[test]
fn test_new_wc_commit_when_wc_immutable() {
let test_env = TestEnvironment::default();
test_env.run_jj_in(".", ["git", "init"]).success();
test_env
.run_jj_in(test_env.env_root(), ["git", "init"])
.success();
test_env
.run_jj_in(test_env.env_root(), ["bookmark", "create", "-r@", "main"])
.run_jj_in(".", ["bookmark", "create", "-r@", "main"])
.success();
test_env.add_config(r#"revset-aliases."immutable_heads()" = "main""#);
test_env
.run_jj_in(test_env.env_root(), ["new", "-m=a"])
.success();
let output = test_env.run_jj_in(test_env.env_root(), ["bookmark", "set", "main", "-r@"]);
test_env.run_jj_in(".", ["new", "-m=a"]).success();
let output = test_env.run_jj_in(".", ["bookmark", "set", "main", "-r@"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Moved 1 bookmarks to kkmpptxz a164195b main | (empty) a
@ -169,14 +163,12 @@ fn test_new_wc_commit_when_wc_immutable() {
#[test]
fn test_immutable_heads_set_to_working_copy() {
let test_env = TestEnvironment::default();
test_env.run_jj_in(".", ["git", "init"]).success();
test_env
.run_jj_in(test_env.env_root(), ["git", "init"])
.success();
test_env
.run_jj_in(test_env.env_root(), ["bookmark", "create", "-r@", "main"])
.run_jj_in(".", ["bookmark", "create", "-r@", "main"])
.success();
test_env.add_config(r#"revset-aliases."immutable_heads()" = "@""#);
let output = test_env.run_jj_in(test_env.env_root(), ["new", "-m=a"]);
let output = test_env.run_jj_in(".", ["new", "-m=a"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
@ -189,9 +181,7 @@ fn test_immutable_heads_set_to_working_copy() {
#[test]
fn test_new_wc_commit_when_wc_immutable_multi_workspace() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["bookmark", "create", "-r@", "main"])
@ -234,9 +224,7 @@ fn test_new_wc_commit_when_wc_immutable_multi_workspace() {
#[test]
fn test_rewrite_immutable_commands() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "a").unwrap();
test_env

View file

@ -17,7 +17,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_init_local_disallowed() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(test_env.env_root(), ["init", "repo"]);
let output = test_env.run_jj_in(".", ["init", "repo"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Error: The native backend is disallowed by default.
@ -32,7 +32,7 @@ fn test_init_local_disallowed() {
fn test_init_local() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"ui.allow-init-native = true"#);
let output = test_env.run_jj_in(test_env.env_root(), ["init", "repo"]);
let output = test_env.run_jj_in(".", ["init", "repo"]);
insta::assert_snapshot!(output, @r#"
------- stderr -------
Initialized repo in "repo"
@ -54,10 +54,7 @@ fn test_init_local() {
assert!(store_path.join("symlinks").is_dir());
assert!(store_path.join("conflicts").is_dir());
let output = test_env.run_jj_in(
test_env.env_root(),
["init", "--ignore-working-copy", "repo2"],
);
let output = test_env.run_jj_in(".", ["init", "--ignore-working-copy", "repo2"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Error: --ignore-working-copy is not respected
@ -65,7 +62,7 @@ fn test_init_local() {
[exit status: 2]
");
let output = test_env.run_jj_in(test_env.env_root(), ["init", "--at-op=@-", "repo3"]);
let output = test_env.run_jj_in(".", ["init", "--at-op=@-", "repo3"]);
insta::assert_snapshot!(output, @r"
------- stderr -------
Error: --at-op is not respected

View file

@ -17,9 +17,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_interdiff_basic() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -86,9 +84,7 @@ fn test_interdiff_basic() {
#[test]
fn test_interdiff_paths() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -144,9 +140,7 @@ fn test_interdiff_paths() {
#[test]
fn test_interdiff_conflicting() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "foo\n").unwrap();

View file

@ -18,9 +18,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_log_with_empty_revision() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["log", "-r="]);
@ -37,9 +35,7 @@ fn test_log_with_empty_revision() {
#[test]
fn test_log_with_no_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["log", "-T"]);
@ -73,9 +69,7 @@ fn test_log_with_no_template() {
#[test]
fn test_log_with_or_without_diff() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -327,9 +321,7 @@ fn test_log_with_or_without_diff() {
#[test]
fn test_log_null_terminate_multiline_descriptions() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -373,9 +365,7 @@ fn test_log_null_terminate_multiline_descriptions() {
#[test]
fn test_log_shortest_accessors() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |rev, template| {
test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r", rev, "-T", template])
@ -492,9 +482,7 @@ fn test_log_shortest_accessors() {
#[test]
fn test_log_bad_short_prefixes() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Suppress warning in the commit summary template
@ -552,9 +540,7 @@ fn test_log_bad_short_prefixes() {
#[test]
fn test_log_prefix_highlight_styled() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
fn prefix_format(len: Option<usize>) -> String {
@ -698,9 +684,7 @@ fn test_log_prefix_highlight_styled() {
#[test]
fn test_log_prefix_highlight_counts_hidden_commits() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
r#"
@ -784,9 +768,7 @@ fn test_log_prefix_highlight_counts_hidden_commits() {
#[test]
fn test_log_short_shortest_length_parameter() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |template| test_env.run_jj_in(&repo_path, ["log", "-T", template]);
@ -819,9 +801,7 @@ fn test_log_short_shortest_length_parameter() {
#[test]
fn test_log_author_format() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
insta::assert_snapshot!(
@ -857,9 +837,7 @@ fn test_log_author_format() {
#[test]
fn test_log_divergence() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let template = r#"description.first_line() ++ if(divergent, " !divergence!")"#;
@ -898,9 +876,7 @@ fn test_log_divergence() {
#[test]
fn test_log_reversed() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -932,9 +908,7 @@ fn test_log_reversed() {
#[test]
fn test_log_filtered_by_path() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -998,7 +972,7 @@ fn test_log_filtered_by_path() {
// "root:<path>" is resolved relative to the workspace root.
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"log",
"-R",
@ -1040,9 +1014,7 @@ fn test_log_filtered_by_path() {
#[test]
fn test_log_limit() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1138,9 +1110,7 @@ fn test_log_limit() {
#[test]
fn test_log_warn_path_might_be_revset() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -1197,9 +1167,7 @@ fn test_log_warn_path_might_be_revset() {
#[test]
fn test_default_revset() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -1232,9 +1200,7 @@ fn test_default_revset() {
#[test]
fn test_default_revset_per_repo() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -1261,9 +1227,7 @@ fn test_default_revset_per_repo() {
#[test]
fn test_multiple_revsets() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
for name in ["foo", "bar", "baz"] {
test_env
@ -1309,9 +1273,7 @@ fn test_multiple_revsets() {
fn test_graph_template_color() {
// Test that color codes from a multi-line template don't span the graph lines.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1366,9 +1328,7 @@ fn test_graph_template_color() {
fn test_graph_styles() {
// Test that different graph styles are available.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1506,9 +1466,7 @@ fn test_graph_styles() {
#[test]
fn test_log_word_wrap() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |args: &[&str], columns: u32, word_wrap: bool| {
let word_wrap = to_toml_value(word_wrap);
@ -1616,9 +1574,7 @@ fn test_log_word_wrap() {
#[test]
fn test_log_diff_stat_width() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |args: &[&str], columns: u32| {
test_env.run_jj_with(|cmd| {
@ -1666,9 +1622,7 @@ fn test_log_diff_stat_width() {
fn test_elided() {
// Test that elided commits are shown as synthetic nodes.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1790,9 +1744,7 @@ fn test_elided() {
fn test_log_with_custom_symbols() {
// Test that elided commits are shown as synthetic nodes.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1881,9 +1833,7 @@ fn test_log_with_custom_symbols() {
#[test]
fn test_log_full_description_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env

View file

@ -20,9 +20,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_new() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -83,9 +81,7 @@ fn test_new() {
#[test]
fn test_new_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -181,9 +177,7 @@ fn test_new_merge() {
#[test]
fn test_new_insert_after() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r"
@ -271,9 +265,7 @@ fn test_new_insert_after() {
#[test]
fn test_new_insert_after_children() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r"
@ -333,9 +325,7 @@ fn test_new_insert_after_children() {
#[test]
fn test_new_insert_before() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r"
@ -406,9 +396,7 @@ fn test_new_insert_before() {
#[test]
fn test_new_insert_before_root_successors() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r"
@ -463,9 +451,7 @@ fn test_new_insert_before_root_successors() {
#[test]
fn test_new_insert_before_no_loop() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
let template = r#"commit_id.short() ++ " " ++ if(description, description, "root")"#;
@ -507,9 +493,7 @@ fn test_new_insert_before_no_loop() {
#[test]
fn test_new_insert_before_no_root_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r"
@ -549,9 +533,7 @@ fn test_new_insert_before_no_root_merge() {
#[test]
fn test_new_insert_before_root() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r"
@ -580,9 +562,7 @@ fn test_new_insert_before_root() {
#[test]
fn test_new_insert_after_before() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r"
@ -658,9 +638,7 @@ fn test_new_insert_after_before() {
#[test]
fn test_new_insert_after_before_no_loop() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
let template = r#"commit_id.short() ++ " " ++ if(description, description, "root")"#;
@ -702,9 +680,7 @@ fn test_new_insert_after_before_no_loop() {
#[test]
fn test_new_conflicting_bookmarks() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -750,9 +726,7 @@ fn test_new_conflicting_bookmarks() {
#[test]
fn test_new_conflicting_change_ids() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -781,9 +755,7 @@ fn test_new_conflicting_change_ids() {
#[test]
fn test_new_error_revision_does_not_exist() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env

View file

@ -29,9 +29,7 @@ fn test_next_simple() {
// third
//
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create a simple linear history, which we'll traverse.
test_env
@ -87,9 +85,7 @@ fn test_next_simple() {
fn test_next_multiple() {
// Move from first => fourth.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -140,9 +136,7 @@ fn test_next_multiple() {
fn test_prev_simple() {
// Move @- from third to second.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -185,9 +179,7 @@ fn test_prev_simple() {
fn test_prev_multiple_without_root() {
// Move @- from fourth to second.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -235,9 +227,7 @@ fn test_prev_multiple_without_root() {
fn test_next_exceeding_history() {
// Try to step beyond the current repos history.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -276,9 +266,7 @@ fn test_next_exceeding_history() {
#[test]
fn test_next_parent_has_multiple_descendants() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Setup.
test_env
@ -323,9 +311,7 @@ fn test_next_parent_has_multiple_descendants() {
#[test]
fn test_next_with_merge_commit_parent() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Setup.
test_env
@ -378,9 +364,7 @@ fn test_next_with_merge_commit_parent() {
#[test]
fn test_next_on_merge_commit() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Setup.
test_env
@ -432,9 +416,7 @@ fn test_next_on_merge_commit() {
#[test]
fn test_next_fails_on_bookmarking_children_no_stdin() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -477,9 +459,7 @@ fn test_next_fails_on_bookmarking_children_no_stdin() {
#[test]
fn test_next_fails_on_bookmarking_children_quit_prompt() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -527,9 +507,7 @@ fn test_next_fails_on_bookmarking_children_quit_prompt() {
#[test]
fn test_next_choose_bookmarking_child() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -570,9 +548,7 @@ fn test_next_choose_bookmarking_child() {
#[test]
fn test_prev_on_merge_commit() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["desc", "-m", "first"])
@ -632,9 +608,7 @@ fn test_prev_on_merge_commit() {
#[test]
fn test_prev_on_merge_commit_with_parent_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["desc", "-m", "x"])
@ -716,9 +690,7 @@ fn test_prev_on_merge_commit_with_parent_merge() {
#[test]
fn test_prev_prompts_on_multiple_parents() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -822,9 +794,7 @@ fn test_prev_prompts_on_multiple_parents() {
#[test]
fn test_prev_beyond_root_fails() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -862,9 +832,7 @@ fn test_prev_beyond_root_fails() {
fn test_prev_editing() {
// Edit the third commit.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -912,9 +880,7 @@ fn test_prev_editing() {
fn test_next_editing() {
// Edit the second commit.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "first"])
@ -961,9 +927,7 @@ fn test_next_editing() {
fn test_prev_conflict() {
// Make the first commit our new parent.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let file_path = repo_path.join("content.txt");
std::fs::write(&file_path, "first").unwrap();
@ -1017,9 +981,7 @@ fn test_prev_conflict() {
fn test_prev_conflict_editing() {
// Edit the third commit.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let file_path = repo_path.join("content.txt");
test_env
@ -1067,9 +1029,7 @@ fn test_next_conflict() {
// There is a conflict in the third commit, so after next it should be the new
// parent.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let file_path = repo_path.join("content.txt");
std::fs::write(&file_path, "first").unwrap();
@ -1119,9 +1079,7 @@ fn test_next_conflict_editing() {
// There is a conflict in the third commit, so after next it should be our
// working copy.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let file_path = repo_path.join("content.txt");
test_env
@ -1162,9 +1120,7 @@ fn test_next_conflict_editing() {
fn test_next_conflict_head() {
// When editing a head with conflicts, `jj next --conflict [--edit]` errors out.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let file_path = repo_path.join("file");
std::fs::write(&file_path, "first").unwrap();
@ -1202,9 +1158,7 @@ fn test_movement_edit_mode_true() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"ui.movement.edit = true"#);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1358,9 +1312,7 @@ fn test_movement_edit_mode_false() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"ui.movement.edit = false"#);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1484,9 +1436,7 @@ fn test_next_offset_when_wc_has_descendants() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"ui.movement.edit = false"#);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env

View file

@ -25,9 +25,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_op_log() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["describe", "-m", "description 0"])
@ -125,9 +123,7 @@ fn test_op_log() {
#[test]
fn test_op_log_with_custom_symbols() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["describe", "-m", "description 0"])
@ -155,9 +151,7 @@ fn test_op_log_with_custom_symbols() {
#[test]
fn test_op_log_with_no_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["op", "log", "-T"]);
@ -191,9 +185,7 @@ fn test_op_log_with_no_template() {
#[test]
fn test_op_log_limit() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["op", "log", "-Tdescription", "--limit=1"]);
@ -206,9 +198,7 @@ fn test_op_log_limit() {
#[test]
fn test_op_log_no_graph() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["op", "log", "--no-graph", "--color=always"]);
@ -234,9 +224,7 @@ fn test_op_log_no_graph() {
#[test]
fn test_op_log_reversed() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["describe", "-m", "description 0"])
@ -333,9 +321,7 @@ fn test_op_log_reversed() {
#[test]
fn test_op_log_no_graph_null_terminated() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "message1"])
@ -362,9 +348,7 @@ fn test_op_log_no_graph_null_terminated() {
#[test]
fn test_op_log_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |template| test_env.run_jj_in(&repo_path, ["op", "log", "-T", template]);
@ -411,9 +395,7 @@ fn test_op_log_template() {
#[test]
fn test_op_log_builtin_templates() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Render without graph to test line ending
let render =
@ -456,9 +438,7 @@ fn test_op_log_builtin_templates() {
#[test]
fn test_op_log_word_wrap() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n".repeat(100)).unwrap();
test_env
@ -610,9 +590,7 @@ fn test_op_log_configurable() {
#[test]
fn test_op_abandon_ancestors() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -744,9 +722,7 @@ fn test_op_abandon_ancestors() {
#[test]
fn test_op_abandon_without_updating_working_copy() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -808,9 +784,7 @@ fn test_op_abandon_without_updating_working_copy() {
#[test]
fn test_op_abandon_multiple_heads() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create 1 base operation + 2 operations to be diverged.
@ -907,7 +881,7 @@ fn test_op_abandon_multiple_heads() {
fn test_op_recover_from_bad_gc() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo", "--colocate"])
.run_jj_in(".", ["git", "init", "repo", "--colocate"])
.success();
let repo_path = test_env.env_root().join("repo");
let git_object_path = |hex: &str| {
@ -1028,9 +1002,7 @@ fn test_op_recover_from_bad_gc() {
#[test]
fn test_op_summary_diff_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Tests in color (easier to read with `less -R`)
@ -1102,7 +1074,7 @@ fn test_op_diff() {
let git_repo_path = test_env.env_root().join("git-repo");
let git_repo = init_bare_git_repo(&git_repo_path);
test_env
.run_jj_in(test_env.env_root(), ["git", "clone", "git-repo", "repo"])
.run_jj_in(".", ["git", "clone", "git-repo", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -1521,9 +1493,7 @@ fn test_op_diff() {
#[test]
fn test_op_diff_patch() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Update working copy with a single file and create new commit.
@ -1622,9 +1592,7 @@ fn test_op_diff_patch() {
#[test]
fn test_op_diff_sibling() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env
@ -1764,7 +1732,7 @@ fn test_op_diff_word_wrap() {
let git_repo_path = test_env.env_root().join("git-repo");
init_bare_git_repo(&git_repo_path);
test_env
.run_jj_in(test_env.env_root(), ["git", "clone", "git-repo", "repo"])
.run_jj_in(".", ["git", "clone", "git-repo", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
let render = |args: &[&str], columns: u32, word_wrap: bool| {
@ -1901,7 +1869,7 @@ fn test_op_show() {
let git_repo_path = test_env.env_root().join("git-repo");
let git_repo = init_bare_git_repo(&git_repo_path);
test_env
.run_jj_in(test_env.env_root(), ["git", "clone", "git-repo", "repo"])
.run_jj_in(".", ["git", "clone", "git-repo", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -2223,9 +2191,7 @@ fn test_op_show() {
#[test]
fn test_op_show_patch() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Update working copy with a single file and create new commit.

View file

@ -20,9 +20,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_parallelize_no_descendants() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
for n in 1..6 {
@ -68,9 +66,7 @@ fn test_parallelize_no_descendants() {
#[test]
fn test_parallelize_with_descendants_simple() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
for n in 1..6 {
@ -120,9 +116,7 @@ fn test_parallelize_with_descendants_simple() {
#[test]
fn test_parallelize_where_interior_has_non_target_children() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
for n in 1..6 {
@ -176,9 +170,7 @@ fn test_parallelize_where_interior_has_non_target_children() {
#[test]
fn test_parallelize_where_root_has_non_target_children() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
for n in 1..4 {
@ -227,9 +219,7 @@ fn test_parallelize_where_root_has_non_target_children() {
#[test]
fn test_parallelize_with_merge_commit_child() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
@ -292,9 +282,7 @@ fn test_parallelize_with_merge_commit_child() {
#[test]
fn test_parallelize_disconnected_target_commits() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
for n in 1..3 {
@ -334,9 +322,7 @@ fn test_parallelize_disconnected_target_commits() {
#[test]
fn test_parallelize_head_is_a_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["commit", "-m=0"])
@ -397,9 +383,7 @@ fn test_parallelize_head_is_a_merge() {
#[test]
fn test_parallelize_interior_target_is_a_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["commit", "-m=0"])
@ -452,9 +436,7 @@ fn test_parallelize_interior_target_is_a_merge() {
#[test]
fn test_parallelize_root_is_a_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["describe", "-m=y"])
@ -510,9 +492,7 @@ fn test_parallelize_root_is_a_merge() {
#[test]
fn test_parallelize_multiple_heads() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["commit", "-m=0"])
@ -552,9 +532,7 @@ fn test_parallelize_multiple_heads() {
#[test]
fn test_parallelize_multiple_heads_with_and_without_children() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["commit", "-m=0"])
@ -593,9 +571,7 @@ fn test_parallelize_multiple_heads_with_and_without_children() {
#[test]
fn test_parallelize_multiple_roots() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["describe", "-m=1"])
@ -643,9 +619,7 @@ fn test_parallelize_multiple_roots() {
#[test]
fn test_parallelize_multiple_heads_with_different_children() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["commit", "-m=1"])
@ -712,9 +686,7 @@ fn test_parallelize_multiple_heads_with_different_children() {
#[test]
fn test_parallelize_multiple_roots_with_different_parents() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["commit", "-m=1"])
@ -773,9 +745,7 @@ fn test_parallelize_multiple_roots_with_different_parents() {
#[test]
fn test_parallelize_complex_nonlinear_target() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["new", "-m=0", "root()"])

View file

@ -38,9 +38,7 @@ fn create_commit(test_env: &TestEnvironment, repo_path: &Path, name: &str, paren
#[test]
fn test_rebase_invalid() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -146,9 +144,7 @@ fn test_rebase_invalid() {
#[test]
fn test_rebase_empty_sets() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -187,9 +183,7 @@ fn test_rebase_empty_sets() {
#[test]
fn test_rebase_bookmark() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -290,9 +284,7 @@ fn test_rebase_bookmark() {
#[test]
fn test_rebase_bookmark_with_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -363,9 +355,7 @@ fn test_rebase_bookmark_with_merge() {
#[test]
fn test_rebase_single_revision() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -442,9 +432,7 @@ fn test_rebase_single_revision() {
#[test]
fn test_rebase_single_revision_merge_parent() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -492,9 +480,7 @@ fn test_rebase_single_revision_merge_parent() {
#[test]
fn test_rebase_multiple_revisions() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -694,9 +680,7 @@ fn test_rebase_multiple_revisions() {
#[test]
fn test_rebase_revision_onto_descendant() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[]);
@ -780,9 +764,7 @@ fn test_rebase_revision_onto_descendant() {
#[test]
fn test_rebase_multiple_destinations() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -899,9 +881,7 @@ fn test_rebase_multiple_destinations() {
#[test]
fn test_rebase_with_descendants() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -1033,9 +1013,7 @@ fn test_rebase_with_descendants() {
#[test]
fn test_rebase_error_revision_does_not_exist() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1069,9 +1047,7 @@ fn test_rebase_error_revision_does_not_exist() {
#[test]
fn test_rebase_with_child_and_descendant_bug_2600() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "notroot", &[]);
@ -1469,9 +1445,7 @@ fn test_rebase_with_child_and_descendant_bug_2600() {
#[test]
fn test_rebase_after() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -2026,9 +2000,7 @@ fn test_rebase_after() {
#[test]
fn test_rebase_before() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -2633,9 +2605,7 @@ fn test_rebase_before() {
#[test]
fn test_rebase_after_before() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "x", &[]);
@ -2918,9 +2888,7 @@ fn test_rebase_after_before() {
#[test]
fn test_rebase_skip_emptied() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -3022,9 +2990,7 @@ fn test_rebase_skip_emptied() {
#[test]
fn test_rebase_skip_emptied_descendants() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);
@ -3086,9 +3052,7 @@ fn test_rebase_skip_emptied_descendants() {
#[test]
fn test_rebase_skip_if_on_destination() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[]);

View file

@ -17,9 +17,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_report_conflicts() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "A\n").unwrap();
@ -111,9 +109,7 @@ fn test_report_conflicts() {
#[test]
fn test_report_conflicts_with_divergent_commits() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env

View file

@ -53,9 +53,7 @@ fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> CommandOutput
#[test]
fn test_resolution() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);
@ -608,9 +606,7 @@ fn check_resolve_produces_input_file(
#[test]
fn test_normal_conflict_input_files() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);
@ -653,9 +649,7 @@ fn test_normal_conflict_input_files() {
#[test]
fn test_baseless_conflict_input_files() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[]);
@ -697,9 +691,7 @@ fn test_baseless_conflict_input_files() {
#[test]
fn test_too_many_parents() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);
@ -733,9 +725,7 @@ fn test_too_many_parents() {
#[test]
fn test_simplify_conflict_sides() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Creates a 4-sided conflict, with fileA and fileB having different conflicts:
@ -869,9 +859,7 @@ fn test_simplify_conflict_sides() {
#[test]
fn test_edit_delete_conflict_input_files() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);
@ -914,9 +902,7 @@ fn test_edit_delete_conflict_input_files() {
#[test]
fn test_file_vs_dir() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);
@ -962,9 +948,7 @@ fn test_file_vs_dir() {
#[test]
fn test_description_with_dir_and_deletion() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);
@ -1027,9 +1011,7 @@ fn test_description_with_dir_and_deletion() {
#[test]
fn test_resolve_conflicts_with_executable() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create a conflict in "file1" where all 3 terms are executables, and create a
@ -1191,9 +1173,7 @@ fn test_resolve_conflicts_with_executable() {
#[test]
fn test_resolve_long_conflict_markers() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Makes it easier to read the diffs between conflicts
@ -1470,9 +1450,7 @@ fn test_resolve_long_conflict_markers() {
#[test]
fn test_multiple_conflicts() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(
@ -1679,9 +1657,7 @@ fn test_multiple_conflicts() {
#[test]
fn test_multiple_conflicts_with_error() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create two conflicted files, and one non-conflicted file

View file

@ -20,9 +20,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_restore() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
@ -167,9 +165,7 @@ fn test_restore() {
#[test]
fn test_restore_conflicted_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);
@ -287,9 +283,7 @@ fn test_restore_conflicted_merge() {
#[test]
fn test_restore_restore_descendants() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "base", &[], &[("file", "base\n")]);
@ -374,9 +368,7 @@ fn test_restore_restore_descendants() {
#[test]
fn test_restore_interactive() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(
@ -480,9 +472,7 @@ fn test_restore_interactive() {
#[test]
fn test_restore_interactive_merge() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(&test_env, &repo_path, "a", &[], &[("file1", "a1\n")]);
@ -562,9 +552,7 @@ fn test_restore_interactive_merge() {
#[test]
fn test_restore_interactive_with_paths() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
create_commit(

View file

@ -17,9 +17,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_syntax_error() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["log", "-r", ":x"]);
@ -86,9 +84,7 @@ fn test_syntax_error() {
#[test]
fn test_bad_function_call() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all(or::nothing)"]);
@ -357,9 +353,7 @@ fn test_bad_function_call() {
#[test]
fn test_parse_warning() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(
@ -421,9 +415,7 @@ fn test_parse_warning() {
#[test]
fn test_function_name_hint() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let evaluate = |expr| test_env.run_jj_in(&repo_path, ["log", "-r", expr]);
@ -492,9 +484,7 @@ fn test_function_name_hint() {
#[test]
fn test_alias() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
@ -660,9 +650,7 @@ fn test_alias() {
#[test]
fn test_alias_override() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
@ -689,9 +677,7 @@ fn test_alias_override() {
#[test]
fn test_bad_alias_decl() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
@ -728,9 +714,7 @@ fn test_bad_alias_decl() {
#[test]
fn test_all_modifier() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Command that accepts single revision by default
@ -866,9 +850,7 @@ fn test_revset_committer_date_with_time_zone() {
const AUSTRALIA: &str = "AEST-10";
let mut test_env = TestEnvironment::default();
test_env.add_env_var("TZ", NEW_YORK);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env

View file

@ -18,7 +18,7 @@ use crate::common::TestEnvironment;
fn test_deprecated_flags() {
let test_env = TestEnvironment::default();
let output = test_env
.run_jj_in(test_env.env_root(), ["util", "completion", "--bash"])
.run_jj_in(".", ["util", "completion", "--bash"])
.success();
insta::assert_snapshot!(output.stderr, @r"
Warning: `jj util completion --bash` will be removed in a future version, and this will be a hard error

View file

@ -19,9 +19,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_show() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["show"]);
@ -40,9 +38,7 @@ fn test_show() {
#[test]
fn test_show_basic() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
@ -247,9 +243,7 @@ fn test_show_basic() {
#[test]
fn test_show_with_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["new", "-m", "a new commit"])
@ -266,9 +260,7 @@ fn test_show_with_template() {
#[test]
fn test_show_with_no_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["show", "-T"]);
@ -302,9 +294,7 @@ fn test_show_with_no_template() {
#[test]
fn test_show_relative_timestamps() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(

View file

@ -29,9 +29,7 @@ backend = "test"
"#,
);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "one"])
@ -115,9 +113,7 @@ backend = "test"
"#,
);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "one"])
@ -185,9 +181,7 @@ backend = "test"
"#,
);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "A"])
@ -235,9 +229,7 @@ backend = "none"
"#,
);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let output = test_env.run_jj_in(&repo_path, ["sign", "-r", "@-"]);
@ -266,9 +258,7 @@ backend = "test"
"#,
);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "one"])
@ -341,9 +331,7 @@ backend = "test"
"#,
);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&repo_path, ["commit", "-m", "one"])

View file

@ -21,9 +21,7 @@ use crate::common::TestEnvironment;
fn create_repo() -> (TestEnvironment, PathBuf) {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
(test_env, repo_path)

View file

@ -19,9 +19,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_sparse_manage_patterns() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -199,9 +197,7 @@ fn test_sparse_editor_avoids_unc() {
use std::path::PathBuf;
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();

View file

@ -41,9 +41,7 @@ fn get_recorded_dates(test_env: &TestEnvironment, cwd: &Path, revset: &str) -> C
#[test]
fn test_split_by_paths() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo").unwrap();
@ -179,9 +177,7 @@ fn test_split_by_paths() {
#[test]
fn test_split_with_non_empty_description() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
test_env.add_config(r#"ui.default-description = "\n\nTESTED=TODO""#);
let workspace_path = test_env.env_root().join("repo");
@ -244,9 +240,7 @@ fn test_split_with_non_empty_description() {
#[test]
fn test_split_with_default_description() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
test_env.add_config(r#"ui.default-description = "\n\nTESTED=TODO""#);
let workspace_path = test_env.env_root().join("repo");
@ -299,9 +293,7 @@ fn test_split_with_default_description() {
#[test]
fn test_split_with_merge_child() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["describe", "-m=1"])
@ -362,9 +354,7 @@ fn test_split_with_merge_child() {
// description is set correctly on the first commit.
fn test_split_siblings_no_descendants() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
test_env.add_config(r#"ui.default-description = "\n\nTESTED=TODO""#);
let workspace_path = test_env.env_root().join("repo");
@ -424,9 +414,7 @@ fn test_split_siblings_no_descendants() {
fn test_split_siblings_with_descendants() {
// Configure the environment and make the initial commits.
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
// test_env.add_config(r#"ui.default-description = "\n\nTESTED=TODO""#);
let workspace_path = test_env.env_root().join("repo");
@ -527,9 +515,7 @@ fn test_split_siblings_with_descendants() {
#[test]
fn test_split_siblings_with_merge_child() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["describe", "-m=1"])
@ -594,9 +580,7 @@ fn test_split_siblings_with_merge_child() {
#[test]
fn test_split_empty() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
test_env
.run_jj_in(&workspace_path, ["describe", "--message", "abc"])
@ -615,9 +599,7 @@ fn test_split_empty() {
#[test]
fn test_split_message_editor_avoids_unc() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo").unwrap();
@ -638,9 +620,7 @@ fn test_split_message_editor_avoids_unc() {
#[test]
fn test_split_interactive() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
std::fs::write(workspace_path.join("file1"), "foo\n").unwrap();
@ -699,9 +679,7 @@ fn test_split_interactive() {
#[test]
fn test_split_interactive_with_paths() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let workspace_path = test_env.env_root().join("repo");
std::fs::write(workspace_path.join("file2"), "").unwrap();
@ -768,9 +746,7 @@ fn test_split_interactive_with_paths() {
#[test]
fn test_split_with_multiple_workspaces_same_working_copy() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
@ -839,9 +815,7 @@ fn test_split_with_multiple_workspaces_same_working_copy() {
#[test]
fn test_split_with_multiple_workspaces_different_working_copy() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
test_env
@ -917,9 +891,7 @@ enum BookmarkBehavior {
#[test_case(BookmarkBehavior::Modern; "modern_behavior")]
fn test_split_with_bookmarks(bookmark_behavior: BookmarkBehavior) {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
match bookmark_behavior {

View file

@ -21,9 +21,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_squash() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -162,9 +160,7 @@ fn test_squash() {
#[test]
fn test_squash_partial() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -334,9 +330,7 @@ fn test_squash_partial() {
#[test]
fn test_squash_keep_emptied() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -389,9 +383,7 @@ fn test_squash_keep_emptied() {
#[test]
fn test_squash_from_to() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create history like this:
@ -553,9 +545,7 @@ fn test_squash_from_to() {
#[test]
fn test_squash_from_to_partial() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create history like this:
@ -762,9 +752,7 @@ fn test_squash_from_to_partial() {
#[test]
fn test_squash_from_multiple() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create history like this:
@ -903,9 +891,7 @@ fn test_squash_from_multiple() {
#[test]
fn test_squash_from_multiple_partial() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create history like this:
@ -1089,9 +1075,7 @@ fn test_squash_from_multiple_partial() {
#[test]
fn test_squash_from_multiple_partial_no_op() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create history like this:
@ -1204,9 +1188,7 @@ fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> CommandOutput
#[test]
fn test_squash_description() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -1316,9 +1298,7 @@ fn test_squash_description() {
#[test]
fn test_squash_description_editor_avoids_unc() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -1348,9 +1328,7 @@ fn test_squash_description_editor_avoids_unc() {
#[test]
fn test_squash_empty() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -1385,9 +1363,7 @@ fn test_squash_empty() {
#[test]
fn test_squash_use_destination_message() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.run_jj_in(&repo_path, ["commit", "-m=a"]).success();
@ -1441,9 +1417,7 @@ fn test_squash_use_destination_message() {
#[test]
fn test_squash_use_destination_message_and_message_mutual_exclusion() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.run_jj_in(&repo_path, ["commit", "-m=a"]).success();
test_env

View file

@ -45,9 +45,7 @@ fn create_commit(
#[test]
fn test_status_copies() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("copy-source"), "copy1\ncopy2\ncopy3\n").unwrap();
@ -81,9 +79,7 @@ fn test_status_copies() {
#[test]
fn test_status_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "base").unwrap();
@ -115,9 +111,7 @@ fn test_status_merge() {
#[test]
fn test_status_ignored_gitignore() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::create_dir(repo_path.join("untracked")).unwrap();
@ -142,9 +136,7 @@ fn test_status_ignored_gitignore() {
#[test]
fn test_status_filtered() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file_1"), "file_1").unwrap();
@ -166,9 +158,7 @@ fn test_status_filtered() {
#[test]
fn test_status_display_relevant_working_commit_conflict_hints() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let conflicted_path = repo_path.join("conflicted.txt");
@ -390,9 +380,7 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
#[test]
fn test_status_simplify_conflict_sides() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Creates a 4-sided conflict, with fileA and fileB having different conflicts:
@ -443,9 +431,7 @@ fn test_status_untracked_files() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"snapshot.auto-track = "none()""#);
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("always-untracked-file"), "...").unwrap();

View file

@ -19,9 +19,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_tag_list() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let git_repo = {
let mut git_repo_path = repo_path.clone();

View file

@ -22,9 +22,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_templater_parse_error() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |template| get_template_output(&test_env, &repo_path, "@-", template);
@ -144,9 +142,7 @@ fn test_templater_parse_error() {
#[test]
fn test_template_parse_warning() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let template = indoc! {r#"
@ -213,9 +209,7 @@ fn test_template_parse_warning() {
#[test]
fn test_templater_upper_lower() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |template| get_colored_template_output(&test_env, &repo_path, "@-", template);
@ -229,9 +223,7 @@ fn test_templater_upper_lower() {
#[test]
fn test_templater_alias() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |template| get_template_output(&test_env, &repo_path, "@-", template);
@ -482,9 +474,7 @@ fn test_templater_alias() {
#[test]
fn test_templater_alias_override() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
@ -513,9 +503,7 @@ fn test_templater_alias_override() {
#[test]
fn test_templater_bad_alias_decl() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config(
@ -544,9 +532,7 @@ fn test_templater_bad_alias_decl() {
#[test]
fn test_templater_config_function() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let render = |template| get_template_output(&test_env, &repo_path, "@-", template);

View file

@ -23,9 +23,7 @@ fn test_undo_rewrite_with_child() {
// Test that if we undo an operation that rewrote some commit, any descendants
// after that will be rebased on top of the un-rewritten commit.
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -68,7 +66,7 @@ fn test_git_push_undo() {
let git_repo_path = test_env.env_root().join("git-repo");
git::init_bare(git_repo_path);
test_env
.run_jj_in(test_env.env_root(), ["git", "clone", "git-repo", "repo"])
.run_jj_in(".", ["git", "clone", "git-repo", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -159,7 +157,7 @@ fn test_git_push_undo_with_import() {
let git_repo_path = test_env.env_root().join("git-repo");
git::init_bare(git_repo_path);
test_env
.run_jj_in(test_env.env_root(), ["git", "clone", "git-repo", "repo"])
.run_jj_in(".", ["git", "clone", "git-repo", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -357,7 +355,7 @@ fn test_git_push_undo_repo_only() {
let git_repo_path = test_env.env_root().join("git-repo");
git::init_bare(git_repo_path);
test_env
.run_jj_in(test_env.env_root(), ["git", "clone", "git-repo", "repo"])
.run_jj_in(".", ["git", "clone", "git-repo", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -417,7 +415,7 @@ fn test_bookmark_track_untrack_undo() {
let git_repo_path = test_env.env_root().join("git-repo");
git::init_bare(git_repo_path);
test_env
.run_jj_in(test_env.env_root(), ["git", "clone", "git-repo", "repo"])
.run_jj_in(".", ["git", "clone", "git-repo", "repo"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -497,9 +495,7 @@ fn test_bookmark_track_untrack_undo() {
#[test]
fn test_shows_a_warning_when_undoing_an_undo_operation_as_bare_jj_undo() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Double-undo creation of child
@ -534,9 +530,7 @@ fn test_shows_a_warning_when_undoing_an_undo_operation_as_bare_jj_undo() {
#[test]
fn test_shows_no_warning_when_undoing_a_specific_undo_change() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.run_jj_in(&repo_path, ["new"]).success();

View file

@ -21,9 +21,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_unsquash() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -170,9 +168,7 @@ fn test_unsquash() {
#[test]
fn test_unsquash_partial() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env
@ -331,9 +327,7 @@ fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> CommandOutput
#[test]
fn test_unsquash_description() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();
@ -415,9 +409,7 @@ fn test_unsquash_description() {
#[test]
fn test_unsquash_description_editor_avoids_unc() {
let mut test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let edit_script = test_env.set_up_fake_editor();

View file

@ -19,7 +19,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_util_config_schema() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(test_env.env_root(), ["util", "config-schema"]);
let output = test_env.run_jj_in(".", ["util", "config-schema"]);
// Validate partial snapshot, redacting any lines nested 2+ indent levels.
insta::with_settings!({filters => vec![(r"(?m)(^ .*$\r?\n)+", " [...]\n")]}, {
assert_snapshot!(output, @r#"
@ -43,10 +43,7 @@ fn test_gc_args() {
let test_env = TestEnvironment::default();
// Use the local backend because GitBackend::gc() depends on the git CLI.
test_env
.run_jj_in(
test_env.env_root(),
["init", "repo", "--config=ui.allow-init-native=true"],
)
.run_jj_in(".", ["init", "repo", "--config=ui.allow-init-native=true"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -75,10 +72,7 @@ fn test_gc_operation_log() {
let test_env = TestEnvironment::default();
// Use the local backend because GitBackend::gc() depends on the git CLI.
test_env
.run_jj_in(
test_env.env_root(),
["init", "repo", "--config=ui.allow-init-native=true"],
)
.run_jj_in(".", ["init", "repo", "--config=ui.allow-init-native=true"])
.success();
let repo_path = test_env.env_root().join("repo");
@ -125,7 +119,7 @@ fn test_shell_completions() {
let test_env = TestEnvironment::default();
// Use the local backend because GitBackend::gc() depends on the git CLI.
let output = test_env
.run_jj_in(test_env.env_root(), ["util", "completion", shell])
.run_jj_in(".", ["util", "completion", shell])
.success();
// Ensures only stdout contains text
assert!(
@ -145,7 +139,7 @@ fn test_util_exec() {
let test_env = TestEnvironment::default();
let formatter_path = assert_cmd::cargo::cargo_bin("fake-formatter");
let output = test_env.run_jj_in(
test_env.env_root(),
".",
[
"util",
"exec",
@ -162,10 +156,7 @@ fn test_util_exec() {
#[test]
fn test_util_exec_fail() {
let test_env = TestEnvironment::default();
let output = test_env.run_jj_in(
test_env.env_root(),
["util", "exec", "--", "jj-test-missing-program"],
);
let output = test_env.run_jj_in(".", ["util", "exec", "--", "jj-test-missing-program"]);
insta::assert_snapshot!(output.strip_stderr_last_line(), @r"
------- stderr -------
Error: Failed to execute external command 'jj-test-missing-program'

View file

@ -20,9 +20,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_snapshot_large_file() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// test a small file using raw-integer-literal syntax, which is interpreted
@ -132,9 +130,7 @@ fn test_snapshot_large_file() {
#[test]
fn test_snapshot_large_file_restore() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
test_env.add_config("snapshot.max-new-file-size = 10");
@ -186,9 +182,7 @@ fn test_snapshot_large_file_restore() {
#[test]
fn test_materialize_and_snapshot_different_conflict_markers() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Configure to use Git-style conflict markers
@ -297,9 +291,7 @@ fn test_materialize_and_snapshot_different_conflict_markers() {
#[test]
fn test_snapshot_invalid_ignore_pattern() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
let gitignore_path = repo_path.join(".gitignore");
@ -331,9 +323,7 @@ fn test_snapshot_invalid_ignore_pattern() {
#[test]
fn test_conflict_marker_length_stored_in_working_copy() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
// Create a conflict in the working copy with long markers on one side

View file

@ -23,9 +23,7 @@ use crate::common::TestEnvironment;
#[test]
fn test_workspaces_add_second_workspace() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
@ -85,9 +83,7 @@ fn test_workspaces_add_second_workspace() {
#[test]
fn test_workspaces_sparse_patterns() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "ws1"])
.success();
test_env.run_jj_in(".", ["git", "init", "ws1"]).success();
let ws1_path = test_env.env_root().join("ws1");
let ws2_path = test_env.env_root().join("ws2");
let ws3_path = test_env.env_root().join("ws3");
@ -157,9 +153,7 @@ fn test_workspaces_sparse_patterns() {
#[test]
fn test_workspaces_add_second_workspace_on_merge() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
test_env
@ -203,9 +197,7 @@ fn test_workspaces_add_second_workspace_on_merge() {
#[test]
fn test_workspaces_add_ignore_working_copy() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
// TODO: maybe better to error out early?
@ -227,9 +219,7 @@ fn test_workspaces_add_ignore_working_copy() {
#[test]
fn test_workspaces_add_at_operation() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
std::fs::write(main_path.join("file1"), "").unwrap();
@ -303,9 +293,7 @@ fn test_workspaces_add_at_operation() {
#[test]
fn test_workspaces_add_workspace_at_revision() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
@ -373,9 +361,7 @@ fn test_workspaces_add_workspace_at_revision() {
#[test]
fn test_workspaces_add_workspace_multiple_revisions() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
std::fs::write(main_path.join("file-1"), "contents").unwrap();
@ -455,9 +441,7 @@ fn test_workspaces_add_workspace_multiple_revisions() {
#[test]
fn test_workspaces_add_workspace_from_subdir() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let subdir_path = main_path.join("subdir");
let secondary_path = test_env.env_root().join("secondary");
@ -497,9 +481,7 @@ fn test_workspaces_add_workspace_from_subdir() {
#[test]
fn test_workspaces_add_workspace_in_current_workspace() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
std::fs::write(main_path.join("file"), "contents").unwrap();
@ -563,9 +545,7 @@ fn test_workspaces_add_workspace_in_current_workspace() {
#[test]
fn test_workspaces_conflicting_edits() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
@ -668,9 +648,7 @@ fn test_workspaces_conflicting_edits() {
#[test]
fn test_workspaces_updated_by_other() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
@ -746,9 +724,7 @@ fn test_workspaces_updated_by_other_automatic() {
let test_env = TestEnvironment::default();
test_env.add_config("[snapshot]\nauto-update-stale = true\n");
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
@ -824,10 +800,7 @@ fn test_workspaces_current_op_discarded_by_other(automatic: bool) {
// Use the local backend because GitBackend::gc() depends on the git CLI.
test_env
.run_jj_in(
test_env.env_root(),
["init", "main", "--config=ui.allow-init-native=true"],
)
.run_jj_in(".", ["init", "main", "--config=ui.allow-init-native=true"])
.success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
@ -1002,9 +975,7 @@ fn test_workspaces_current_op_discarded_by_other(automatic: bool) {
#[test]
fn test_workspaces_update_stale_noop() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let output = test_env.run_jj_in(&main_path, ["workspace", "update-stale"]);
@ -1038,9 +1009,7 @@ fn test_workspaces_update_stale_noop() {
#[test]
fn test_workspaces_update_stale_snapshot() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
@ -1079,9 +1048,7 @@ fn test_workspaces_update_stale_snapshot() {
#[test]
fn test_workspaces_forget() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
std::fs::write(main_path.join("file"), "contents").unwrap();
@ -1152,9 +1119,7 @@ fn test_workspaces_forget() {
#[test]
fn test_workspaces_forget_multi_transaction() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
std::fs::write(main_path.join("file"), "contents").unwrap();
@ -1211,9 +1176,7 @@ fn test_workspaces_forget_multi_transaction() {
#[test]
fn test_workspaces_forget_abandon_commits() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
std::fs::write(main_path.join("file"), "contents").unwrap();
@ -1294,9 +1257,7 @@ fn test_workspaces_forget_abandon_commits() {
#[test]
fn test_list_workspaces_template() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
test_env.add_config(
r#"
templates.commit_summary = """commit_id.short() ++ " " ++ description.first_line() ++
@ -1337,9 +1298,7 @@ fn test_list_workspaces_template() {
#[test]
fn test_workspaces_root() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
@ -1379,9 +1338,7 @@ fn test_workspaces_root() {
#[test]
fn test_debug_snapshot() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "repo"])
.success();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file"), "contents").unwrap();
@ -1419,9 +1376,7 @@ fn test_debug_snapshot() {
#[test]
fn test_workspaces_rename_nothing_changed() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
let output = test_env.run_jj_in(&main_path, ["workspace", "rename", "default"]);
insta::assert_snapshot!(output, @r"
@ -1434,9 +1389,7 @@ fn test_workspaces_rename_nothing_changed() {
#[test]
fn test_workspaces_rename_new_workspace_name_already_used() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
test_env
.run_jj_in(
@ -1457,9 +1410,7 @@ fn test_workspaces_rename_new_workspace_name_already_used() {
#[test]
fn test_workspaces_rename_forgotten_workspace() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
test_env
.run_jj_in(
@ -1483,9 +1434,7 @@ fn test_workspaces_rename_forgotten_workspace() {
#[test]
fn test_workspaces_rename_workspace() {
let test_env = TestEnvironment::default();
test_env
.run_jj_in(test_env.env_root(), ["git", "init", "main"])
.success();
test_env.run_jj_in(".", ["git", "init", "main"]).success();
let main_path = test_env.env_root().join("main");
test_env
.run_jj_in(