Commit Graph

25 Commits

Author SHA1 Message Date
Colin
348bfd5f6d tests.fetchgit.withGitConfig: fix build 2026-03-02 17:56:54 +00:00
Emily
ad90665682 tests.fetchgit: pass system and the existing config 2026-02-19 16:07:50 +00:00
Yueh-Shun Li
89746696de tests.fetchgit: add submodule-revision-count 2025-12-17 01:19:46 +08:00
Yueh-Shun Li
d4dd261ab5 nix-prefetch-git: fetch the fetching tag for NIX_PREFETCH_GIT_CHECKOUT_HOOK
Co-authored-by: Adam Dinwoodie <adam@dinwoodie.org>
2025-12-17 01:14:55 +08:00
Yueh-Shun Li
cbd24f4a8a tests.fetchgit: add simple-tag 2025-12-09 12:27:32 +08:00
Yueh-Shun Li
fc295b1e28 fetchgit: take postCheckout to allow collecting revision without leaving .git 2025-12-09 12:27:27 +08:00
Alexander Bantyev
80d9975bd4 config: add a gitConfig/gitConfigFile option
Adds a `gitConfig` option (and `gitConfigFile`), to set a default
`gitConfigFile` argument for `fetchgit`.
2025-09-29 22:34:54 +02:00
Alexander Bantyev
296399ec68 fetchgit: add a gitConfigFile argument
Passing a `gitConfigFile` argument as a string allows setting a custom
git config (as `$GIT_CONFIG_GLOBAL`). The most obvious use is to
override URLs with custom mirrors, but others are possible too.
2025-09-29 22:34:11 +02:00
Silvan Mosberger
7d75d07d44 nix-prefetch-git: Add regression test for avoiding fetching cached paths 2025-09-24 22:18:32 +04:00
Alexander Bantyev
f12f3dfb21 nix-prefetch-git: add --no-add-path argument
Adds a new argument to `nix-prefetch-git`: `--no-add-path`. It disables
adding the path to the store. It is useful when working with a read-only
store.
2025-09-24 22:18:32 +04:00
Yuriy Taraday
34612851db fetchgit: Add rootDir argument
With this argument fetchgit will make a subdirectory of the Git
repository a root of the resulting store path. This is helpful for
dealing with monorepos where many projects are in separate directories
and don't need a new source hash every time the monorepo is updated.

Commit hash is removed from the name of the derivation to prevent it
from changing the store path when nothing in the subdirectory changes.
2025-08-08 16:20:05 +02:00
Philip Taron
7ee611b07f tests.fetchgit.fetchTags: fix flaky test by removing .git directory after getting tags
Closes #412967
2025-06-02 10:51:02 -07:00
Tim Black
1247031689 pkgs/build-support/fetchgit: add fetchTags parameter
Added fetchTags feature to fetchgit, explicit and clear support for
fetching all tags after the source tree fetch completes. Doing this at
build-time in the fetcher is required for packages that invoke commands
like 'git describe' which require tags, and since the nix store is
read-only by design, it is not possible to git fetch --tags at
activation- or run-time. This feature may have been possible by
specifying a postFetch option including calling git fetch --tags,
however doing so obfuscates the solution to this very real problem.
Explicit support for fetching tags should be a first class citizen just
like fetching other refs.
2025-05-28 16:47:34 -07:00
Silvan Mosberger
e52d633a63 Merge remote-tracking branch 'upstream/staging-next' into staging 2025-04-02 18:30:54 +02:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Adam Dinwoodie
eee9a856bf git: use zlib-ng rather than zlib
Git v2.49.0 added support for using the faster zlib-ng library, and
benchmarks by GitLab show it's notably faster, so use it for our builds
too.

The different zlib implementation does change the contents of the .git
directory, which means the hashes for fetchgit tests that leave the .git
directory in place are expected to change.

https://about.gitlab.com/blog/2025/03/14/whats-new-in-git-2-49-0/#introduction-of-zlib-ng
2025-03-16 15:05:24 +00:00
Adam Dinwoodie
003998bcb5 tests.fetchgit: test deep clone without .git
The deepClone argument to fetchgit implies leaveDotGit.  Make the
"submodule-deep" fetchgit test more useful by having it remove the .git
directory, as recommended in the fetchgit documentation, so it is
distinguished from the "submodule-leave-git-deep" test.
2025-03-16 14:57:01 +00:00
Adam Dinwoodie
5a847c0878 git: 2.47.2 -> 2.48.1
This version change includes a change to the contents of the .git
directory, which results in changes to hashes for any fetchgit
invocations that set leaveDotGit to true.  Per the fetchgit
documentation and discussions in #372784, the contents of the .git directory are not stable, so
anyone using that should either only be using it for temporary testing
purposes, or should be removing the .git directory in fetchgit's
postFetch phase, so before the hash is calculated.  That means there's
no need to do any other handling here to avoid compatibility problems,
and can just update the relevant hashes in the fetchgit tests.

There's still a chance this will break some other builds because of the
change to the contents of the .git directory.  If so, whoever's
responsible for those other derivations should either stop using
leaveDotGit, or should follow the documented advice to remove the .git
directory in the postFetch phase.
2025-02-11 20:00:01 +00:00
Scott Worley
697bba9892 fetchgit: Support fetching signed tags over dumb http transport 2024-04-22 02:16:02 +02:00
Shogo Takata
d6e1c7cae6 fetchgit: shallow clone for submodules (#254172) 2023-11-09 04:32:13 +02:00
Nicolas Benes
f6b07f0e2f fetchgit: make sparseCheckout a list of strings
The `sparseCheckout` argument allows the user to specify directories or
patterns of files, which Git uses to filter files it should check-out.

Git expects a multi-line string on stdin ("newline-delimited list", see
`git-sparse-checkout(1)`), but within nixpkgs it is more consistent to
use a list of strings instead. The list elements are joined to a
multi-line string only before passing it to the builder script.

A deprecation warning is emitted if a (multi-line) string is passed to
`sparseCheckout`, but for the time being it is still accepted.
2022-11-15 19:45:33 +01:00
Winter
dbd18a63a7 fetchgit: allow disabling cone mode for sparse checkouts, fix test 2022-08-14 23:03:07 +02:00
Robert Hensing
c071530ca5 testers.invalidateFetcherByDrvHash: Move from top-level 2022-05-05 12:08:50 +02:00
Zhong Jianxin
36cc03e151 fetchgit: Add test for sparseCheckout 2022-01-24 11:23:56 +08:00
Robert Hensing
0fa3d10d7d fetchgit.tests: init 2021-08-28 10:29:10 +02:00