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

Wrong entry order in tree object #848

Closed
1 task done
SilkovAlexander opened this issue May 11, 2023 · 2 comments · Fixed by #849
Closed
1 task done

Wrong entry order in tree object #848

SilkovAlexander opened this issue May 11, 2023 · 2 comments · Fixed by #849
Assignees

Comments

@SilkovAlexander
Copy link

Duplicates

  • I have searched the existing issues

Current behavior 😯

Current implementation sorts the tree entries alphabetically without looking at the entry type, but git (at least on Ubuntu) sorts it in a slightly different manner. Git virtually "adds" '/' to tree filenames.
git sorted list of entries:

100644 blob a7f8d9e5dcf3a68fdd2bfb727cde12029875260b    bin
100644 blob 257cc5642cb1a054f08cc83f2d943e56fd3ebe99    bin.d
100644 blob 6c493ff740f9380390d5c9ddef4af18697ac9375    file.to
100644 blob e2129701f1a4d54dc44f03c93bca0a2aec7c5449    file.toml
100644 blob 7c8ac2f8d82a1eb5f6aaece6629ff11015f91eb4    file.toml.bin
040000 tree 66ad2859083f44f0a1504dc91c15c9b754372c01    file
100644 blob 8d80099b0791274e24014d8dc299d4d2f3c2054d    file0

and this implementation rakes into account only filenames.

Expected behavior 🤔

I'd expect this code of Ord trait implementation for Entry add '/' symbol to tree filenames for comparing/

Steps to reproduce 🕹

No response

@Byron Byron self-assigned this May 11, 2023
@Byron
Copy link
Member

Byron commented May 11, 2023

Thanks for letting me know!

There have been plenty of subtle bugs cropping up over time because of this. This should be the correct implementation.

@Byron Byron linked a pull request May 11, 2023 that will close this issue
2 tasks
@Byron
Copy link
Member

Byron commented May 11, 2023

The fix was released with v0.29.2, and it should be pulled in automatically if the latest version of gix is used.

EliahKagan added a commit to EliahKagan/gitoxide that referenced this issue Oct 14, 2024
This updates the "git_cmp_c" and "git_cmp_rs" links in the
`gix_diff::tree::function::diff` documentation comment.

- The significant change is to the "git_cmp_rs" link (the second
  link), which accounts for how files have renamed and how code has
  been moved, and also changed in GitoxideLabs#849 to fix issue GitoxideLabs#848.

  This hyperlink change completes the third task listed in GitoxideLabs#1627.

- The other change is to update the "git_cmp_c" link at the same
  time. That code has not changed, and this is just referring to a
  later commit (the current tip of the master branch in git/git).

  The reason to also do this change is to make it easier to verify,
  both now and for anyone reading the documentation, that that link
  remains current.
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 a pull request may close this issue.

2 participants