fetchgit: take postCheckout to allow gathering revision and commit metadata without leaving .git#465497
Conversation
|
|
|
143961b to
08c189f
Compare
|
Test cases improved. |
08c189f to
63c5be3
Compare
|
Be aware that |
postCheckout to allow git-describe without leaving .gitpostCheckout to allow gathering commit messages without leaving .git
postCheckout to allow gathering commit messages without leaving .gitpostCheckout to allow gathering revision and commit metadata without leaving .git
Atemu
left a comment
There was a problem hiding this comment.
This sounds and looks sensible to me
Is there a reproducer to demonstrate this non-reproducibility? |
|
Also, wouldn't this only occur when upstream changes tags retroactively? That's not a case our regular fetchgit can handle gracefully either. |
|
Not only change. It can happen if they add a tag anywhere that
Right, if you specify |
|
I'm not worried about the non-determinism of It's on the user to make sure they use the tools in a way that isn't inherently fragile. Someone relying on a source package marked "development latest" would be a poor idea, as would relying on a Git repository where tags aren't fixed (as GitHub recommends with GitHub Actions, for example). I'd expect using |
8d97c10 to
65f011e
Compare
So the non-reproducibility is brought by Considering this, let's avoid the use of As for unstable versions that specifies the Git revision directly but still want |
|
All the |
eb3c6ad to
2945886
Compare
|
I'd like to merge in a day or two. Hopefully @me-and has a chance to review. |
I should be able to take a look (and, more to the point, a think) in the next couple of days. If you want to merge before then, that's absolutely fine; if I have any feedback that really needs addressing we can iterate from that point. |
There was a problem hiding this comment.
This looks fantastically useful, thank you! I think it wants a few fixes before it's quite ready to be merged, but it's all just tidying to improve long-term maintainability; the fundamental changes are spot on.
nixpkgs-review result
Generated using nixpkgs-review.
Command: nixpkgs-review pr 465497
Commit: 29458868f15aa1d1227e931f2c9f07690ba2fc5e
x86_64-linux
✅ 92 packages built:
- bundix
- cabal2nix
- chirpstack-concentratord
- corto
- crate2nix
- crush
- crystal2nix
- dub-to-nix
- gcalcli
- gcalcli.dist
- git-unroll
- haskellPackages.cli-nix
- haskellPackages.cli-nix.doc
- haskellPackages.nix-thunk
- haskellPackages.nix-thunk.doc
- haskellPackages.nvfetcher
- haskellPackages.nvfetcher.doc
- haskellPackages.update-nix-fetchgit
- haskellPackages.update-nix-fetchgit.doc
- kcl
- lixPackageSets.git.nix-update
- lixPackageSets.git.nix-update.dist
- lixPackageSets.latest.nix-update (lixPackageSets.lix_2_94.nix-update)
- lixPackageSets.latest.nix-update.dist (lixPackageSets.lix_2_94.nix-update.dist)
- lixPackageSets.stable.nix-update (lixPackageSets.lix_2_93.nix-update)
- lixPackageSets.stable.nix-update.dist (lixPackageSets.lix_2_93.nix-update.dist)
- localtunnel
- lon
- luarocks-packages-updater
- luarocks-packages-updater.dist
- mdwatch
- meshlab
- mlv-app
- nim_lk
- nix-prefetch-git
- nix-prefetch-scripts
- nix-update
- nix-update-source
- nix-update-source.dist
- nix-update.dist
- npins
- nvfetcher
- outline
- prefetch-yarn-deps
- prowlarr
- python312Packages.pymeshlab
- python313Packages.nixpkgs-updaters-library
- python313Packages.nixpkgs-updaters-library.dist
- python313Packages.pymeshlab
- radarr
- sonarr
- sus-compiler
- tests.fetchFromBitbucket.withEncodedWhitespaceGit
- tests.fetchFromGitHub.fetchTags
- tests.fetchFromGitHub.leave-git
- tests.fetchFromGitHub.rootDir
- tests.fetchFromGitHub.sparseCheckout
- tests.fetchFromGitHub.sparseCheckoutNonConeMode
- tests.fetchFromGitHub.submodule-deep
- tests.fetchFromGitHub.submodule-leave-git
- tests.fetchFromGitHub.submodule-leave-git-deep
- tests.fetchFromGitHub.submodule-simple
- tests.fetchgit.cached-prefetch-avoids-fetch
- tests.fetchgit.collect-rev
- tests.fetchgit.describe-tag
- tests.fetchgit.dumb-http-signed-tag
- tests.fetchgit.fetchTags
- tests.fetchgit.leave-git
- tests.fetchgit.prefetch-git-no-add-path
- tests.fetchgit.rootDir
- tests.fetchgit.simple
- tests.fetchgit.simple-tag
- tests.fetchgit.sparseCheckout
- tests.fetchgit.sparseCheckoutNonConeMode
- tests.fetchgit.submodule-deep
- tests.fetchgit.submodule-leave-git
- tests.fetchgit.submodule-leave-git-deep
- tests.fetchgit.submodule-revision-count
- tests.fetchgit.submodule-simple
- tests.fetchgit.withGitConfig
- tests.fetchurl.header
- tests.haskell.cabalSdist.assumptionLocalHasDirectReference
- tests.haskell.cabalSdist.localHasNoDirectReference
- tests.testers.runCommand.bork
- typescript-language-server
- update-nix-fetchgit
- update-python-libraries
- vclab-nexus
- vclab-nexus.bin
- vimPluginsUpdater
- xosd-xft
- yarn2nix
…T_HOOK Co-authored-by: Adam Dinwoodie <adam@dinwoodie.org>
2945886 to
e348c7b
Compare
Co-authored-by: Adam Dinwoodie <adam@dinwoodie.org>
e348c7b to
8974669
Compare
|
Commit 7e08567 broke It seems like this commit is not achieving its intended effect as tags are indeed not fetched where it was expected before. This should probably be reverted as it's breaking backward compatibility? |
This is not intended. @RaitoBezarius Could you help test if PR #473411 now restores the hash compatibility? |
Following NixOS#465497 it's possible to specify `postCheckout` to perform actions after repo is fetched but before `.git` is deleted. Signed-off-by: Marcin Serwin <marcin@serwin.dev>
Following NixOS#465497 it's possible to specify `postCheckout` to perform actions after repo is fetched but before `.git` is deleted. Signed-off-by: Marcin Serwin <marcin@serwin.dev>
Description
This PR introduces the
postCheckoutargument forfetchgitto allow running shell commands (especiallygit describe) before the.gitdirectory is removed or sanitized. It usesnix-prefetch-git's existing support to environment variableNIX_PREFETCH_GIT_CHECKOUT_HOOK, while giving it a more friendly name.To make
git describework when specifyingfetchgit { tag = "my_tag"; ... }, this PR also creates a reference of the same name (path) as the--rev <ref>'s<ref>operand.Partially addresses PR #8567
fetchgitwithleaveDotGit = trueis still not completely deterministic #8567Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.