-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn user about the working copy when configuring the author
- Loading branch information
1 parent
6c28ca6
commit 01197eb
Showing
3 changed files
with
110 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -857,6 +857,30 @@ fn test_config_show_paths() { | |
"###); | ||
} | ||
|
||
#[test] | ||
fn test_config_author_change_warning() { | ||
let test_env = TestEnvironment::default(); | ||
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); | ||
let repo_path = test_env.env_root().join("repo"); | ||
let (stdout, stderr) = test_env.jj_cmd_ok( | ||
&repo_path, | ||
&["config", "set", "--repo", "user.email", "'Foo'"], | ||
); | ||
insta::assert_snapshot!(stdout, @""); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Warning: This setting will only impact future commits. | ||
The author of the working copy will stay "Test User <[email protected]>". | ||
To change the working copy author, use "jj describe --reset-author --no-edit" | ||
"###); | ||
|
||
let mut log_cmd = test_env.jj_cmd(&repo_path, &["describe", "--reset-author", "--no-edit"]); | ||
log_cmd.env_remove("JJ_EMAIL"); | ||
log_cmd.assert().success(); | ||
|
||
let (stdout, _) = test_env.jj_cmd_ok(&repo_path, &["log"]); | ||
assert!(stdout.contains("Foo")); | ||
} | ||
|
||
fn find_stdout_lines(keyname_pattern: &str, stdout: &str) -> String { | ||
let key_line_re = Regex::new(&format!(r"(?m)^{keyname_pattern} = .*$")).unwrap(); | ||
key_line_re | ||
|