Skip to content

Commit

Permalink
fix: Repository::tree_merge_options() now comes with rewrite tracking.
Browse files Browse the repository at this point in the history
This is the way Git acts, as it's either configured, or defaults to the value
coming from the `diff.renames` configuration.
  • Loading branch information
Byron committed Nov 24, 2024
1 parent 0a5993f commit b57be71
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 262 deletions.
2 changes: 1 addition & 1 deletion gix/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 14 additions & 6 deletions gix/src/repository/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<crate::merge::tree::Options, tree_merge_options::Error> {
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,
Expand Down
Loading

0 comments on commit b57be71

Please sign in to comment.