diff --git a/lib/src/settings.rs b/lib/src/settings.rs index a9daec340..98713fd10 100644 --- a/lib/src/settings.rs +++ b/lib/src/settings.rs @@ -79,8 +79,14 @@ impl UserSettings { } let mut env_config = config::Config::new(); - if let Ok(timestamp_str) = env::var("JJ_TIMESTAMP") { - env_config.set("user.timestamp", timestamp_str)?; + if let Ok(value) = env::var("JJ_USER") { + env_config.set("user.name", value)?; + } + if let Ok(value) = env::var("JJ_EMAIL") { + env_config.set("user.email", value)?; + } + if let Ok(value) = env::var("JJ_TIMESTAMP") { + env_config.set("user.timestamp", value)?; } config.merge(env_config)?; diff --git a/src/testutils.rs b/src/testutils.rs index 63f086642..f5abf412d 100644 --- a/src/testutils.rs +++ b/src/testutils.rs @@ -52,6 +52,8 @@ impl TestEnvironment { *command_number += 1; let timestamp = timestamp + chrono::Duration::seconds(*command_number); cmd.env("JJ_TIMESTAMP", timestamp.to_rfc3339()); + cmd.env("JJ_USER", "Test User"); + cmd.env("JJ_EMAIL", "test.user@example.com"); cmd } diff --git a/tests/smoke_test.rs b/tests/smoke_test.rs index e6bdfea8a..9a161d640 100644 --- a/tests/smoke_test.rs +++ b/tests/smoke_test.rs @@ -27,7 +27,7 @@ fn smoke_test() { let assert = test_env.jj_cmd(&repo_path, &["status"]).assert().success(); insta::assert_snapshot!(get_stdout_string(&assert), @r###" Parent commit: 000000000000 - Working copy : 1d1984a23811 + Working copy : 230dd059e1b0 The working copy is clean "###); @@ -41,7 +41,7 @@ fn smoke_test() { let stdout_string = get_stdout_string(&assert); insta::assert_snapshot!(stdout_string, @r###" Parent commit: 000000000000 - Working copy : 5e60c5091e43 + Working copy : d38745675403 Working copy changes: A file1 A file2 @@ -60,11 +60,11 @@ fn smoke_test() { .jj_cmd(&repo_path, &["describe", "-m", "add some files"]) .assert() .success(); - insta::assert_snapshot!(get_stdout_string(&assert), @"Working copy now at: 6f13b3e41065 add some files + insta::assert_snapshot!(get_stdout_string(&assert), @"Working copy now at: 701b3d5a2eb3 add some files "); // Close the commit let assert = test_env.jj_cmd(&repo_path, &["close"]).assert().success(); - insta::assert_snapshot!(get_stdout_string(&assert), @"Working copy now at: 6ff8a22d8ce1 + insta::assert_snapshot!(get_stdout_string(&assert), @"Working copy now at: a13f828fab1a "); } diff --git a/tests/test_global_opts.rs b/tests/test_global_opts.rs index b5fd4f006..8d512aa4c 100644 --- a/tests/test_global_opts.rs +++ b/tests/test_global_opts.rs @@ -31,7 +31,7 @@ fn test_no_commit_working_copy() { .success(); let stdout_string = get_stdout_string(&assert); insta::assert_snapshot!(stdout_string, @r###" - @ 1e9ff0ea7220c37a1d2c4aab153e238c12ff3cd0 + @ 438471f3fbf1004298d8fb01eeb13663a051a643 o 0000000000000000000000000000000000000000 "###); @@ -53,7 +53,7 @@ fn test_no_commit_working_copy() { .assert() .success(); insta::assert_snapshot!(get_stdout_string(&assert), @r###" - @ cc12440b719c67fcd8c55848eb345f67b6e2d9f1 + @ fab22d1acf5bb9c5aa48cb2c3dd2132072a359ca o 0000000000000000000000000000000000000000 "###); }