diff --git a/CHANGELOG.md b/CHANGELOG.md index b030545ec7..b3ad1cd41e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 in the working copy no longer leads to a crash ([#976](https://github.com/martinvonz/jj/issues/976)). +* Conflicts in executable files can now be resolved just like conflicts in + non-executable files ([#1279](https://github.com/martinvonz/jj/issues/1279)). + ## [0.10.0] - 2023-10-04 ### Breaking changes diff --git a/cli/tests/test_chmod_command.rs b/cli/tests/test_chmod_command.rs index 8ba47e5a84..21d39a5787 100644 --- a/cli/tests/test_chmod_command.rs +++ b/cli/tests/test_chmod_command.rs @@ -73,10 +73,13 @@ fn test_chmod_regular_conflict() { let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "file"]); insta::assert_snapshot!(stdout, @r###" - Conflict: - Removing file with id df967b96a579e45a18b8251732d16804b2e56a55 - Adding executable file with id 587be6b4c3f93f93c489c0111bba5596147a26cb - Adding file with id 8ba3a16384aacc37d01564b28401755ce8053f51 + <<<<<<< + %%%%%%% + -base + +x + +++++++ + n + >>>>>>> "###); // Test chmodding a conflict @@ -89,10 +92,13 @@ fn test_chmod_regular_conflict() { let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "file"]); insta::assert_snapshot!(stdout, @r###" - Conflict: - Removing executable file with id df967b96a579e45a18b8251732d16804b2e56a55 - Adding executable file with id 587be6b4c3f93f93c489c0111bba5596147a26cb - Adding executable file with id 8ba3a16384aacc37d01564b28401755ce8053f51 + <<<<<<< + %%%%%%% + -base + +x + +++++++ + n + >>>>>>> "###); test_env.jj_cmd_ok(&repo_path, &["chmod", "n", "file"]); let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]); @@ -232,8 +238,11 @@ fn test_chmod_file_dir_deletion_conflicts() { let stdout = test_env.jj_cmd_success(&repo_path, &["cat", "-r=file_deletion", "file"]); insta::assert_snapshot!(stdout, @r###" - Conflict: - Removing executable file with id df967b96a579e45a18b8251732d16804b2e56a55 - Adding executable file with id 78981922613b2afb6025042ff6bd878ac1994e85 + <<<<<<< + +++++++ + a + %%%%%%% + -base + >>>>>>> "###); } diff --git a/lib/src/merge.rs b/lib/src/merge.rs index 7c77ffe530..159172090b 100644 --- a/lib/src/merge.rs +++ b/lib/src/merge.rs @@ -447,15 +447,14 @@ impl Merge> { .all(|value| matches!(value, Some(TreeValue::Tree(_)) | None)) } - /// If this merge contains only non-executable files or absent entries, - /// returns a merge of the `FileId`s`. + /// If this merge contains only files or absent entries, returns a merge of + /// the `FileId`s`. The executable bits will be ignored. Use + /// `Merge::with_new_file_ids()` to produce a new merge with the original + /// executable bits preserved. pub fn to_file_merge(&self) -> Option>> { self.maybe_map(|term| match term { None => Some(None), - Some(TreeValue::File { - id, - executable: false, - }) => Some(Some(id.clone())), + Some(TreeValue::File { id, executable: _ }) => Some(Some(id.clone())), _ => None, }) }