From b57be7189df216110adb52aa51c50a0f38692f2a Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 23 Nov 2024 16:27:28 +0100 Subject: [PATCH] fix: `Repository::tree_merge_options()` now comes with rewrite tracking. This is the way Git acts, as it's either configured, or defaults to the value coming from the `diff.renames` configuration. --- gix/src/diff.rs | 2 +- gix/src/repository/merge.rs | 20 +- gix/tests/gix/object/tree/diff.rs | 340 ++++++++---------------------- gix/tests/gix/repository/merge.rs | 13 ++ gix/tests/gix/repository/mod.rs | 2 + 5 files changed, 115 insertions(+), 262 deletions(-) create mode 100644 gix/tests/gix/repository/merge.rs diff --git a/gix/src/diff.rs b/gix/src/diff.rs index 01361b1bbdd..f1789b1f816 100644 --- a/gix/src/diff.rs +++ b/gix/src/diff.rs @@ -175,7 +175,7 @@ pub(crate) mod utils { new_rewrites_inner(config, lenient, &Diff::RENAMES, &Diff::RENAME_LIMIT) } - pub fn new_rewrites_inner( + pub(crate) fn new_rewrites_inner( config: &gix_config::File<'static>, lenient: bool, renames: &'static crate::config::tree::diff::Renames, diff --git a/gix/src/repository/merge.rs b/gix/src/repository/merge.rs index d501359cacb..4756ac2433b 100644 --- a/gix/src/repository/merge.rs +++ b/gix/src/repository/merge.rs @@ -89,12 +89,20 @@ impl Repository { /// Read all relevant configuration options to instantiate options for use in [`merge_trees()`](Self::merge_trees). pub fn tree_merge_options(&self) -> Result { Ok(gix_merge::tree::Options { - rewrites: crate::diff::utils::new_rewrites_inner( - &self.config.resolved, - self.config.lenient_config, - &tree::Merge::RENAMES, - &tree::Merge::RENAME_LIMIT, - )?, + rewrites: Some( + crate::diff::utils::new_rewrites_inner( + &self.config.resolved, + self.config.lenient_config, + &tree::Merge::RENAMES, + &tree::Merge::RENAME_LIMIT, + )? + .map(Ok) + .or_else(|| { + crate::diff::utils::new_rewrites(&self.config.resolved, self.config.lenient_config).transpose() + }) + .transpose()? + .unwrap_or_default(), + ), blob_merge: self.blob_merge_options()?, blob_merge_command_ctx: self.command_context()?, fail_on_conflict: None, diff --git a/gix/tests/gix/object/tree/diff.rs b/gix/tests/gix/object/tree/diff.rs index cf44645d7cd..92ca7a6a65e 100644 --- a/gix/tests/gix/object/tree/diff.rs +++ b/gix/tests/gix/object/tree/diff.rs @@ -79,35 +79,23 @@ fn changes_against_tree_modified() -> crate::Result { [ Modification { location: "a", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(78981922613b2afb6025042ff6bd878ac1994e85), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(b4f17b61de71d9b2e54ac9e62b1629ae2d97a6a7), }, Modification { location: "dir", - previous_entry_mode: EntryMode( - 16384, - ), + previous_entry_mode: EntryMode(0o40000), previous_id: Sha1(e5c63aefe4327cb1c780c71966b678ce8e4225da), - entry_mode: EntryMode( - 16384, - ), + entry_mode: EntryMode(0o40000), id: Sha1(c7ac5f82f536976f3561c9999b5f11e5893358be), }, Modification { location: "dir/c", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(6695780ceb14b05e076a99bbd2babf34723b3464), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(40006fcef15a8853a1b7ae186d93b7d680fd29cf), }, ] @@ -227,9 +215,7 @@ mod track_rewrites { [ Rewrite { source_location: "cli/src/commands/cat.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: None, source_id: Sha1(f09e8b0e6bf963d8d6d5b578fea48ff4c9b723fb), diff: Some( @@ -241,9 +227,7 @@ mod track_rewrites { similarity: 0.900421, }, ), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(081093be2ba0d2be62d14363f43859355bee2aa2), location: "cli/src/commands/file/print.rs", relation: Some( @@ -255,9 +239,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_cat_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: None, source_id: Sha1(8c80364c37b7fc364778efb4214575536e6a1df4), diff: Some( @@ -269,9 +251,7 @@ mod track_rewrites { similarity: 0.77923656, }, ), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(45bb2cf6b7fa96a39c95301f619ca3e4cc3eb0f3), location: "cli/tests/test_file_print_command.rs", relation: None, @@ -279,9 +259,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_chmod_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: None, source_id: Sha1(c24ae8e04f53b84e09838d232b3e8c0167ccc010), diff: Some( @@ -293,9 +271,7 @@ mod track_rewrites { similarity: 0.88720536, }, ), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(8defe631bc82bf35a53cd25083f85664516f412f), location: "cli/tests/test_file_chmod_command.rs", relation: None, @@ -303,9 +279,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/src/commands/chmod.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: None, source_id: Sha1(8f55dec5b81779d23539fa7146d713cc42df70f4), diff: Some( @@ -317,9 +291,7 @@ mod track_rewrites { similarity: 0.9060576, }, ), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(94f78deb408d181ccea9da574d0e45ac32a98092), location: "cli/src/commands/file/chmod.rs", relation: Some( @@ -331,13 +303,9 @@ mod track_rewrites { }, Modification { location: "CHANGELOG.md", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(f4cb24f79ec2549a3a8a5028d4c43d953f74137d), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(5a052b7fb0919218b2ecddffbb341277bd443a5c), }, Addition { @@ -347,141 +315,91 @@ mod track_rewrites { 1, ), ), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(d67f782327ea286136b8532eaf9a509806a87e83), }, Modification { location: "cli/src/commands/mod.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(e7e8c4f00412aa9bc9898f396ef9a7597aa64756), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(e3a9ec4524d27aa7035a38fd7c5db414809623c4), }, Modification { location: "cli/tests/cli-reference@.md.snap", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(5c1985fc3c89a8d0edaedc23f76feb7f5c4cc962), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(92853cde19b20cadd74113ea3566c87d4def591b), }, Modification { location: "cli/tests/runner.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(a008cb19a57bd44a5a054fced38384b09c9243fc), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(5253f0ff160e8b7001a7bd271ca4a07968ff81a3), }, Modification { location: "cli/tests/test_acls.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(e7e8f15d7f4c0c50aad13b0f82a632e3d55c33c6), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(f644e4c8dd0be6fbe5493b172ce10839bcd9e25c), }, Modification { location: "cli/tests/test_diffedit_command.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(85e7db4f01d8be8faa7a020647273399f815f597), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(fd57f61e92d4d49b4920c08c3522c066cb03ecd2), }, Modification { location: "cli/tests/test_fix_command.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(16ab056981c9ca40cdd4d298feb70510cc3ced37), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(e0baefc79038fed0bcf56f2d8c3588a26d5bf985), }, Modification { location: "cli/tests/test_global_opts.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(44f49aec05b7dc920cf1f1a554016e74b06ee1c8), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(a0c0340e495fa759c0b705dd46cee322aa0d80c8), }, Modification { location: "cli/tests/test_immutable_commits.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(ba61cefef4328f126283f25935aab2d04ae2016e), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(3d7598b4e4c570eef701f40853ef3e3b0fb224f7), }, Modification { location: "cli/tests/test_move_command.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(cbd36dbc76760ed41c968f369b470b45c176dabe), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(ac9ad5761637cd731abe1bf4a075fedda7bfc61f), }, Modification { location: "cli/tests/test_new_command.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(3e03295d9b4654adccb6cd625376c36d4d38fb3d), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(a03b50a8a9c23c68d641b51b7c887ea088cd0d2b), }, Modification { location: "cli/tests/test_squash_command.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(f921d5bc423586194bd73419f9814ff072212faa), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(ff1c247d4312adb5b372c6d9ff93fa71846ca527), }, Modification { location: "cli/tests/test_unsquash_command.rs", - previous_entry_mode: EntryMode( - 33188, - ), + previous_entry_mode: EntryMode(0o100644), previous_id: Sha1(0dcc138981223171df13d35444c7aaee4b502c6f), - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(b8b29cc0ca0176fafaa97c7421a10ed116bcba8a), }, ] @@ -512,9 +430,7 @@ mod track_rewrites { [ Rewrite { source_location: "cli", - source_entry_mode: EntryMode( - 16384, - ), + source_entry_mode: EntryMode(0o40000), source_relation: Some( Parent( 2, @@ -522,9 +438,7 @@ mod track_rewrites { ), source_id: Sha1(f203064a6a81df47498fb415a2064a8ec568ed67), diff: None, - entry_mode: EntryMode( - 16384, - ), + entry_mode: EntryMode(0o40000), id: Sha1(f203064a6a81df47498fb415a2064a8ec568ed67), location: "c", relation: Some( @@ -536,9 +450,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/src/commands/file/print.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -546,9 +458,7 @@ mod track_rewrites { ), source_id: Sha1(081093be2ba0d2be62d14363f43859355bee2aa2), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(081093be2ba0d2be62d14363f43859355bee2aa2), location: "c/src/commands/file/print.rs", relation: Some( @@ -560,9 +470,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/src/commands/file", - source_entry_mode: EntryMode( - 16384, - ), + source_entry_mode: EntryMode(0o40000), source_relation: Some( ChildOfParent( 2, @@ -570,9 +478,7 @@ mod track_rewrites { ), source_id: Sha1(0f3bc154b577b84fb5ce31383e25acc99c2f24a5), diff: None, - entry_mode: EntryMode( - 16384, - ), + entry_mode: EntryMode(0o40000), id: Sha1(0f3bc154b577b84fb5ce31383e25acc99c2f24a5), location: "c/src/commands/file", relation: Some( @@ -584,9 +490,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests", - source_entry_mode: EntryMode( - 16384, - ), + source_entry_mode: EntryMode(0o40000), source_relation: Some( ChildOfParent( 2, @@ -594,9 +498,7 @@ mod track_rewrites { ), source_id: Sha1(17be3b367831653883a36a2f2a8dea418b8d96b7), diff: None, - entry_mode: EntryMode( - 16384, - ), + entry_mode: EntryMode(0o40000), id: Sha1(17be3b367831653883a36a2f2a8dea418b8d96b7), location: "c/tests", relation: Some( @@ -608,9 +510,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_immutable_commits.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -618,9 +518,7 @@ mod track_rewrites { ), source_id: Sha1(3d7598b4e4c570eef701f40853ef3e3b0fb224f7), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(3d7598b4e4c570eef701f40853ef3e3b0fb224f7), location: "c/tests/test_immutable_commits.rs", relation: Some( @@ -632,9 +530,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_file_print_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -642,9 +538,7 @@ mod track_rewrites { ), source_id: Sha1(45bb2cf6b7fa96a39c95301f619ca3e4cc3eb0f3), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(45bb2cf6b7fa96a39c95301f619ca3e4cc3eb0f3), location: "c/tests/test_file_print_command.rs", relation: Some( @@ -656,9 +550,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/runner.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -666,9 +558,7 @@ mod track_rewrites { ), source_id: Sha1(5253f0ff160e8b7001a7bd271ca4a07968ff81a3), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(5253f0ff160e8b7001a7bd271ca4a07968ff81a3), location: "c/tests/runner.rs", relation: Some( @@ -680,9 +570,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/src", - source_entry_mode: EntryMode( - 16384, - ), + source_entry_mode: EntryMode(0o40000), source_relation: Some( ChildOfParent( 2, @@ -690,9 +578,7 @@ mod track_rewrites { ), source_id: Sha1(80e5b08f25f75c2050afbcb794e8434f4cf082f1), diff: None, - entry_mode: EntryMode( - 16384, - ), + entry_mode: EntryMode(0o40000), id: Sha1(80e5b08f25f75c2050afbcb794e8434f4cf082f1), location: "c/src", relation: Some( @@ -704,9 +590,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_file_chmod_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -714,9 +598,7 @@ mod track_rewrites { ), source_id: Sha1(8defe631bc82bf35a53cd25083f85664516f412f), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(8defe631bc82bf35a53cd25083f85664516f412f), location: "c/tests/test_file_chmod_command.rs", relation: Some( @@ -728,9 +610,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/cli-reference@.md.snap", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -738,9 +618,7 @@ mod track_rewrites { ), source_id: Sha1(92853cde19b20cadd74113ea3566c87d4def591b), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(92853cde19b20cadd74113ea3566c87d4def591b), location: "c/tests/cli-reference@.md.snap", relation: Some( @@ -752,9 +630,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/src/commands/file/chmod.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -762,9 +638,7 @@ mod track_rewrites { ), source_id: Sha1(94f78deb408d181ccea9da574d0e45ac32a98092), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(94f78deb408d181ccea9da574d0e45ac32a98092), location: "c/src/commands/file/chmod.rs", relation: Some( @@ -776,9 +650,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_new_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -786,9 +658,7 @@ mod track_rewrites { ), source_id: Sha1(a03b50a8a9c23c68d641b51b7c887ea088cd0d2b), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(a03b50a8a9c23c68d641b51b7c887ea088cd0d2b), location: "c/tests/test_new_command.rs", relation: Some( @@ -800,9 +670,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_global_opts.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -810,9 +678,7 @@ mod track_rewrites { ), source_id: Sha1(a0c0340e495fa759c0b705dd46cee322aa0d80c8), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(a0c0340e495fa759c0b705dd46cee322aa0d80c8), location: "c/tests/test_global_opts.rs", relation: Some( @@ -824,9 +690,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_move_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -834,9 +698,7 @@ mod track_rewrites { ), source_id: Sha1(ac9ad5761637cd731abe1bf4a075fedda7bfc61f), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(ac9ad5761637cd731abe1bf4a075fedda7bfc61f), location: "c/tests/test_move_command.rs", relation: Some( @@ -848,9 +710,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_unsquash_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -858,9 +718,7 @@ mod track_rewrites { ), source_id: Sha1(b8b29cc0ca0176fafaa97c7421a10ed116bcba8a), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(b8b29cc0ca0176fafaa97c7421a10ed116bcba8a), location: "c/tests/test_unsquash_command.rs", relation: Some( @@ -872,9 +730,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/src/commands/file/mod.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -882,9 +738,7 @@ mod track_rewrites { ), source_id: Sha1(d67f782327ea286136b8532eaf9a509806a87e83), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(d67f782327ea286136b8532eaf9a509806a87e83), location: "c/src/commands/file/mod.rs", relation: Some( @@ -896,9 +750,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_fix_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -906,9 +758,7 @@ mod track_rewrites { ), source_id: Sha1(e0baefc79038fed0bcf56f2d8c3588a26d5bf985), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(e0baefc79038fed0bcf56f2d8c3588a26d5bf985), location: "c/tests/test_fix_command.rs", relation: Some( @@ -920,9 +770,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/src/commands/mod.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -930,9 +778,7 @@ mod track_rewrites { ), source_id: Sha1(e3a9ec4524d27aa7035a38fd7c5db414809623c4), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(e3a9ec4524d27aa7035a38fd7c5db414809623c4), location: "c/src/commands/mod.rs", relation: Some( @@ -944,9 +790,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/src/commands", - source_entry_mode: EntryMode( - 16384, - ), + source_entry_mode: EntryMode(0o40000), source_relation: Some( ChildOfParent( 2, @@ -954,9 +798,7 @@ mod track_rewrites { ), source_id: Sha1(f414de88468352d59c129d0e7686fb1e1f387929), diff: None, - entry_mode: EntryMode( - 16384, - ), + entry_mode: EntryMode(0o40000), id: Sha1(f414de88468352d59c129d0e7686fb1e1f387929), location: "c/src/commands", relation: Some( @@ -968,9 +810,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_acls.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -978,9 +818,7 @@ mod track_rewrites { ), source_id: Sha1(f644e4c8dd0be6fbe5493b172ce10839bcd9e25c), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(f644e4c8dd0be6fbe5493b172ce10839bcd9e25c), location: "c/tests/test_acls.rs", relation: Some( @@ -992,9 +830,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_diffedit_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -1002,9 +838,7 @@ mod track_rewrites { ), source_id: Sha1(fd57f61e92d4d49b4920c08c3522c066cb03ecd2), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(fd57f61e92d4d49b4920c08c3522c066cb03ecd2), location: "c/tests/test_diffedit_command.rs", relation: Some( @@ -1016,9 +850,7 @@ mod track_rewrites { }, Rewrite { source_location: "cli/tests/test_squash_command.rs", - source_entry_mode: EntryMode( - 33188, - ), + source_entry_mode: EntryMode(0o100644), source_relation: Some( ChildOfParent( 2, @@ -1026,9 +858,7 @@ mod track_rewrites { ), source_id: Sha1(ff1c247d4312adb5b372c6d9ff93fa71846ca527), diff: None, - entry_mode: EntryMode( - 33188, - ), + entry_mode: EntryMode(0o100644), id: Sha1(ff1c247d4312adb5b372c6d9ff93fa71846ca527), location: "c/tests/test_squash_command.rs", relation: Some( diff --git a/gix/tests/gix/repository/merge.rs b/gix/tests/gix/repository/merge.rs new file mode 100644 index 00000000000..9aa117c0126 --- /dev/null +++ b/gix/tests/gix/repository/merge.rs @@ -0,0 +1,13 @@ +use crate::util::named_repo; + +#[test] +fn tree_merge_options() -> crate::Result { + let repo = named_repo("make_basic_repo.sh")?; + let opts: gix::merge::plumbing::tree::Options = repo.tree_merge_options()?.into(); + assert_eq!( + opts.rewrites, + Some(gix::diff::Rewrites::default()), + "If merge options aren't set, it defaults to diff options, and these default to doing rename tracking" + ); + Ok(()) +} diff --git a/gix/tests/gix/repository/mod.rs b/gix/tests/gix/repository/mod.rs index e9d1df4e4ab..37a6bc73fcd 100644 --- a/gix/tests/gix/repository/mod.rs +++ b/gix/tests/gix/repository/mod.rs @@ -5,6 +5,8 @@ mod config; mod excludes; #[cfg(feature = "attributes")] mod filter; +#[cfg(feature = "merge")] +mod merge; mod object; mod open; #[cfg(feature = "attributes")]