-
Notifications
You must be signed in to change notification settings - Fork 203
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
Make fetching source tarball by git commit more robust #4680
base: develop
Are you sure you want to change the base?
Make fetching source tarball by git commit more robust #4680
Conversation
A `git fetch <repo> <hash>` requires a full hash and fails with a short hash with > could not find remote ref Disable the depth=1 optimization and remove the fetch call for those cases.
I also think this checkout only works until github garbage collects. This dangling commit it just held on by reflog, and will disappear with a git gc. So, 90 days or so and it's gone i think. I am in favor of just fetching what we need for the requested checkout, but it wouldn't actually solve the underlying issue; UV devs are throwing away their old patches. I think the devs here should tag/branch their commit and not leave it detached, and the old method would still work (I think). So the cost here would be that we wouldn't detect this issue until the source is truly forever gone. Note: I think you meant reqwest-middleware as that's the onethat has the commit you mention here: (edit: I could be wrong, maybe github never GC's? But i doubt that) |
Not sure: I locally created a commit, amended and ran
Yes, mis-pasted. Fixed in the description |
I think it does go out, unless github sets up their reflog expiry date to something infinite. Testing it out: mkdir test-gc
cd test-gc
git init
echo "First version" > file.txt
git add file.txt
git commit -m "First version"
echo "Modified version" > file.txt
git add file.txt
git commit --amend -m "Modified version"
git reflog # both show up and i can checkout either
git reflog expire --expire=now --all # default is 90 days but i don't want to wait
git gc
git switch ca00a7a # now gives me "fatal: invalid reference: ca00a7a" Just gc isn't enough, the reglof need to expire before that's cleaned up. |
Ah ok, so the reflog needs to be GCed. I guess in that case we cannot do anything. At least the change makes the checkouts faster and gives us 90 days more time. |
Yes the UV devs should at least just add a |
It isn't actually uv but a dependency of it. And that repo doesn't has an issue tracker so I could complain. Also the commit is currently only in a branch, not somewhere in main, i.e. not merged yet. So can't help that for now. |
But it's the UV devs patching their dependencies is it not? (on several repos under https://github.com/astral-sh) |
Ah it's the same GitHub org, haven't seen that. I opened an issue in the |
(created using
eb --new-pr
)I had a crate that was supposed to fetch a git commit from https://github.com/astral-sh/reqwest-middleware. However the specified git commit
21ceec9a5fd2e8d6f71c3ea2999078fecbd13cbe
was not available forgit checkout
after the clone.My understanding is, that this commit is not reachable from the default (main) branch that is fetched, possibly after same rebase.
The approach done here is to add a separate
git fetch
call to fetch the specified commit. That resolves the issue in my case.We could go even further and don't use
git clone
at all: