Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: git attrs calculation #173

Merged
merged 4 commits into from
Feb 16, 2025
Merged

fix: git attrs calculation #173

merged 4 commits into from
Feb 16, 2025

Conversation

tisonkun
Copy link
Member

This closes #171

@@ -151,7 +153,7 @@ pub fn resolve_file_attrs(

Ok::<_, Infallible>(Default::default())
})?;
prev_commit = this_commit;
next_commit = this_commit;
Copy link
Member Author

@tisonkun tisonkun Feb 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch is a follow-up to #150 and GitoxideLabs/gitoxide#1395.

@Byron I'm figuring out how to walk the first commit tree. That said, the current logic iterate all the commits and calculate the changes between a next commit and a current commit. The iteration will exit on the very first (root) commit, then all the changes in the root commit won't be handled.

I'm not quite sure how to get a full change list (or just iterate all the files in the root commit). Investigating...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to have an empty source tree to compare with if a commit has no parents.
There is an alternative API now, https://docs.rs/gix/latest/gix/struct.Repository.html#method.diff_tree_to_tree, which might make this more obvious and/or easier to use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Byron Thanks a lot for your information! I use it in 272eee0 and everything looks correct now.

It was the right choice to ask you first :D

@tisonkun tisonkun merged commit e43787d into main Feb 16, 2025
17 checks passed
@tisonkun tisonkun deleted the git-attr branch February 16, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect attrs.git_file_created_year and attrs.git_file_modified_year
2 participants