-
-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Wrong refs returned by repo.references()?.local_branches()?
sometimes in non-garbage-collected repos
#1850
Comments
repo.references()?.local_branches()?
sometimesrepo.references()?.local_branches()?
sometimes in non-garbage-collected repos
Thanks a lot for reporting and the instructions for reproduction! The problem here lies within the overlay iterator which is supposed to list loose references over packed ones if there is a choice. It seems that this fails here as there is a |
I have create a PR with the reproduction, one that makes pretty clear what's happening. The iterators for packed-refs and loose refs are supposed to be sorted to stay in sync, but apparently that's not the case anymore due to the subdirectory. It appears that the order in packed-refs is files-first, but the order of the iterator is directory-first. A fix is on the way, I hope to finish it till the weekend. |
Thank you! No rush on my account; while I think this definitely needs to be fixed in the medium term, few people will probably encounter it in the wild until I'm a bit confused by the reproduction in a5c7adb since I see no evidence of the buggy behavior in the |
Indeed, it's the desired good state, and the test fails in this commit as 'the one' reference appears twice. |
Current behavior 😯
I'm not sure how to have a minimal example, but I'll attach the repo where I saw this problem.
TLDR, I have these two branches:
However, when I use
gix
to get the list of references, it lists "refs/heads/ig-pr4021" twice, with different ids:As the names suggest,
ig-pr4021
used to point to21b57
, but that was a long time ago.The program that generated the above output is:
I'm using gix v0.70.0 on ARM Mac OS. I can send you my lockfile, but I just populated it today; I'm hoping you can easily reproduce this (if you're OK with downloading my repo).
Workaround
Running
git gc
fixed this.Expected behavior 🤔
The program should only print
Git behavior
See above
Steps to reproduce 🕹
See above.
(I will upload the repo in a bit and edit this message)(done).The repo is at https://drive.google.com/file/d/14pheDpbYL8u9p8VWKWIIO4gbv3xjy35t/view?usp=sharing (150MB). Sorry for the size but, again, running
git gc
makes the bug go away.The text was updated successfully, but these errors were encountered: