nix-prefetch-git: fix checkout_ref() for "dumb http" repositories#116289
Closed
logan12358 wants to merge 1 commit intoNixOS:masterfrom
Closed
nix-prefetch-git: fix checkout_ref() for "dumb http" repositories#116289logan12358 wants to merge 1 commit intoNixOS:masterfrom
logan12358 wants to merge 1 commit intoNixOS:masterfrom
Conversation
The checkout_ref() function was written against Git 1.6.5, just before "smart http" repositories were implemented in Git 1.6.6. In 1.6.5, the `--depth` parameter is ignored when fetching from a dumb http repository. From 1.6.6, this scenario causes a failure. This change updates the comment and falls back to fetching without `--depth`.
This comment was marked as spam.
This comment was marked as spam.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/cant-build-solvespace-from-scratch-fetching-git-source-fails/46536/2 |
Contributor
|
Hi @logan12358 , could you help check if PR #283663 addressed the issue? I refactored the code a bit in PR #465497 to
Nevertheless, it would be better if we could check if a remote support the smart protocol or not instead of retrying blindly, but I don't know how to implement such check. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
checkout_ref()function was written against Git 1.6.5, just before "smart http" repositories were implemented in Git 1.6.6. In 1.6.5, the--depthparameter is ignored when fetching from a dumb http repository. From 1.6.6, this scenario causes a failure. This change updates the comment and falls back to fetching without--depth.Motivation for this change
This change causes
checkout_refto succeed in cases where I believe it is intended. I think that previously fetches from a dumb http repository would usually succeed through thecheckout_hashfallback. As of #104714checkout_hashdoesn't seem to support tags (perhaps this should be changed as well?), so nownix-prefetch-gitnoticeably fails for tag revs on dumb http repositories.I'm not 100% convinced about the chained
||, but I can't find a way to instruct Git to "attempt"--depth=1or find a way to robustly fall back only if the first fetch fails due to a "dumb http" repository.This seems to resolve #115145.
Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)