Enhance git metadata handling in compute_git_metadata function

- Updated the `compute_git_metadata` function to include canonical path resolution for changed files, improving the accuracy of ID retrieval from the tree.
- Implemented logic to check both the original and canonical paths for file IDs, ensuring comprehensive coverage of file changes.

These changes enhance the robustness of git metadata handling, ensuring more reliable synchronization behavior.
This commit is contained in:
Joe 2026-02-17 21:16:51 -06:00
parent 6dec06865f
commit bb4d40c4d3

View file

@ -187,7 +187,16 @@ pub fn compute_git_metadata(tree_handle: &Arc<Mutex<RojoTree>>, repo_root: &Path
for rel_path in &changed_files { for rel_path in &changed_files {
let abs_path = repo_root.join(rel_path); let abs_path = repo_root.join(rel_path);
let ids = tree.get_ids_at_path(&abs_path); let canonical_path = std::fs::canonicalize(&abs_path).ok();
let first = tree.get_ids_at_path(&abs_path);
let ids = if !first.is_empty() {
first
} else if let Some(ref canon) = canonical_path {
tree.get_ids_at_path(canon)
} else {
first
};
for &id in ids { for &id in ids {
if let Some(instance) = tree.get_instance(id) { if let Some(instance) = tree.get_instance(id) {