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-fsck to handle non-root trees #1332

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

cesfahani
Copy link
Contributor

  • Trees except the commit's root tree were being skipped
  • Make check_commit() the only functioning marking trees as "seen"
  • Update unit tests to catch the failure (add a directory to test repo)

@cesfahani
Copy link
Contributor Author

@Byron This was trivial logic bug introduced during the refactor of making gix-fsck::Connectivity::check_commit() be non-recursive.

Apologies for the silence during the past few months. Had a new baby boy added to the family, so took a bit to get back to my normal work capacity!

- Trees except the commit's root tree were being skipped
- Make `check_commit()` the only functioning marking trees as "seen"
- Update unit tests to catch the failure (add a directory to test repo)
@cesfahani cesfahani force-pushed the fix_fsck_tree_traversal branch from 0ca4562 to 5fdb440 Compare April 2, 2024 04:12
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Apologies for the silence during the past few months. Had a new baby boy added to the family, so took a bit to get back to my normal work capacity!

Welcome back, and, I can totally imagine :)!

Regarding the PR, for now I treat the fsck as mostly maintained by you, so I don't have to fully understand or validate each and every bit as I would normally do. Having had a look at git fsck, I know it's actually a very complex program with a lot of tests, making this version humble beginnings tailor-made for a specific use-case.

With that in mind, I also think it's OK to have an fsck which is able to validate received packs, and do so quickly, and this crate is certainly a step in that direction. However, to be really fast, I think ultimately it has to be integrated into the pack-resolution algorithm as it also sees every object once with the decoding being 'free' and ultra-efficient, with the main problem being its multi-threadedness.

@@ -80,9 +80,7 @@ where
match entry_ref.mode.kind() {
EntryKind::Tree => {
let tree_id = entry_ref.oid.to_owned();
if self.seen.insert(tree_id) {
Copy link
Member

Choose a reason for hiding this comment

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

I do admit that I don't get how it solves the recursion issue, as I would have thought the seen check is to assure it doesn't look at the same tree twice.

@Byron Byron merged commit 4bb8ef5 into GitoxideLabs:main Apr 2, 2024
18 checks passed
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.

2 participants