Robert Hensing
274d887fee
fetchTree/git: Cache export-ignore filter
2024-01-12 17:18:56 +01:00
Robert Hensing
d80c582b78
libfetchers: Add CachingFilteringInputAccessor
...
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2024-01-12 17:16:59 +01:00
Robert Hensing
469cf263c7
Format
2024-01-12 15:31:53 +01:00
Robert Hensing
692e9197bc
fetchTree: Disallow combination of submodules and exportIgnore for now
2024-01-12 15:31:53 +01:00
Robert Hensing
99bd12f0b1
fetchGit/fetchTree: Improve exportIgnore, submodule interaction
...
Also fingerprint and some preparatory improvements.
Testing is still not up to scratch because lots of logic is duplicated
between the workdir and commit cases.
2024-01-12 15:31:53 +01:00
Robert Hensing
7774eff10e
libfetchers/git: Move workdir accessor into GitRepo::getAccessor
2024-01-12 15:31:53 +01:00
Robert Hensing
467c62a96e
GitRepoImpl: Move exportIgnore into a filtering accessor
2024-01-12 15:31:53 +01:00
Robert Hensing
cd5e752fa7
GitRepoImpl::getSubmodules: Access getSubmoduleRev without cast
...
This will be needed because the accessor will be wrapped, and therefore
not be an instance of GitInputAccessor anymore.
2024-01-12 15:31:53 +01:00
Robert Hensing
f6b1d15580
MakeNotAllowedError: Touch up doc
2024-01-12 15:31:53 +01:00
Robert Hensing
ce6d58a97c
git fetcher: Add exportIgnore parameter
...
Enabled for fetchGit, which historically had this behavior,
among other behaviors we do not want in fetchGit.
fetchTree disables this parameter by default. It can choose the
simpler behavior, as it is still experimental.
I am not confident that the filtering implementation is future
proof. It should reuse a source filtering wrapper, which I believe
Eelco has already written, but not merged yet.
2024-01-12 15:31:52 +01:00
John Ericson
84502674f8
Merge pull request #9736 from obsidiansystems/mingw-makefiles
...
Some small Makefile improvements to prepare for Windows support
2024-01-11 10:58:55 -05:00
John Ericson
423484ad26
Only link with -pthread
on Unix
...
We don't want this with MinGW.
2024-01-10 20:38:39 -05:00
Rebecca Turner
4feb7d9f71
Combine AbstractPos
, PosAdapter
, and Pos
...
Also move `SourcePath` into `libutil`.
These changes allow `error.hh` and `error.cc` to access source path and
position information, which we can use to produce better error messages
(for example, we could consider omitting filenames when two or more
consecutive stack frames originate from the same file).
2024-01-08 10:59:41 -08:00
Eelco Dolstra
359990dfdc
Merge pull request #9324 from 9999years/fix-8854-take-2
...
Don't attempt to `git add` ignored files
2024-01-05 14:57:32 +01:00
John Ericson
dfc876531f
Organize content addressing, use SourceAccessor
with Store::addToStore
...
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-12-18 10:41:54 -05:00
Eelco Dolstra
103ca0bde5
Improve SourcePath display
2023-12-13 13:27:29 +01:00
Robert Hensing
d4f6b1d38b
Merge pull request #9497 from edolstra/move-access-control
...
Move restricted/pure-eval access control out of the evaluator and into the accessor
2023-12-08 22:21:50 +01:00
Peter Kolloch
fc6f29053a
Renamed HashFormat::Base32 to HashFormat::Nix32
...
...and also adjusted parsing accordingly.
Also added CLI completion for HashFormats.
https://github.com/NixOS/nix/issues/8876
2023-12-06 23:43:42 +01:00
Peter Kolloch
5334c9c792
HashType: Rename to HashAlgorithm
...
To be consistent with CLI, nix API
and many other references.
As part of this, we also converted it to a scoped enum.
https://github.com/NixOS/nix/issues/8876
2023-12-06 23:43:42 +01:00
Eelco Dolstra
2bd8322500
Update src/libfetchers/filtering-input-accessor.hh
...
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-12-06 14:08:40 +01:00
Eelco Dolstra
504e4fc457
CanonPath: Support std::hash
2023-12-06 13:45:59 +01:00
Eelco Dolstra
8cafc754d8
Move access control from FSInputAccessor to FilteringInputAccessor
2023-11-30 21:54:53 +01:00
Rebecca Turner
be30c2ea8d
Don't attempt to git add
ignored files
...
This uses `git check-ignore` to determine if files are ignored before
attempting to add them in `putFile`.
We also add a condition to the `fetchFromWorkdir` filter to always add
the `flake.lock` file, even if it's not tracked. This is necessary to
resolve inputs.
This fixes #8854 without `git add --force`.
2023-11-30 10:26:13 -08:00
Eelco Dolstra
43d9fb6cf1
Remove InputAccessor::root()
2023-11-30 16:44:54 +01:00
Théophane Hufschmitt
6a94755b12
Allow user input in git commit
...
We occasionnally commit to git repositories (like with `nix flake update --commit-lock-file`).
This shells out to `git commit`, which might wait for user input (for a signing key passphrase for instance).
Disable the progress bar while this is running to make sure that the
user can enter it.
2023-11-24 11:45:37 +01:00
Eelco Dolstra
38844943d0
Merge pull request #9413 from edolstra/fetchToStore-cache
...
Persistently cache `InputAccessor::fetchToStore()`
2023-11-22 12:19:25 +01:00
Eelco Dolstra
b1ab592f28
Use the StorePath-based cache interface
2023-11-22 11:44:02 +01:00
Eelco Dolstra
61b76f5f34
Apply suggestion
...
Co-authored-by: John Ericson <git@JohnEricson.me>
2023-11-22 11:26:12 +01:00
Robert Hensing
9cd69e1c39
Merge pull request #9411 from edolstra/path-display
...
Improve SourceAccessor path display
2023-11-21 18:12:01 +01:00
Eelco Dolstra
99d5204baa
Persistently cache InputAccessor::fetchToStore()
...
This avoids repeated copying of the same source tree between Nix
invocations. It requires the accessor to have a "fingerprint" (e.g. a
Git revision) that uniquely determines its contents.
2023-11-20 20:04:37 +01:00
Eelco Dolstra
a0162d5732
Improve SourceAccessor path display
...
Backported from lazy-trees. This allows SourceAccessors to show the
origin of the accessor. E.g. we now get
copying '«git+https://github.com/blender/blender.git?ref=refs/heads/main&rev=4edc1389337dd3679ff66969c332d2aff52e1992»/ ' to the store
instead of
copying '/' to the store
2023-11-20 18:54:36 +01:00
Eelco Dolstra
071f14a0bb
Don't do shallow fetches over ssh
2023-11-20 17:25:40 +01:00
Eelco Dolstra
e4066c0444
Fetch specific Git revisions
...
This is more efficient, and necessary when using shallow=1 with a rev.
2023-11-20 17:25:40 +01:00
Eelco Dolstra
7ab91e7238
Implement shallow fetching
2023-11-15 15:00:17 +01:00
Eelco Dolstra
5dd4ae8687
Remove unused cacheType field
2023-11-15 14:08:34 +01:00
Eelco Dolstra
2890999911
Show Git fetch progress
2023-11-15 13:57:20 +01:00
Eelco Dolstra
2964a9f562
Fix relative submodule handling
...
Tested on
nix flake prefetch 'git+https://github.com/blender/blender.git?rev=4ed8a360e956daf2591add4d3c9ec0719e2628fe&submodules=1 '
2023-11-14 16:00:21 +01:00
Eelco Dolstra
6ec6b8aa36
Improve git submodule error reporting
2023-11-14 15:52:18 +01:00
Eelco Dolstra
c257c82447
Cleanup
2023-11-14 14:47:17 +01:00
Eelco Dolstra
7f576f5dfe
Rename UnionInputAccessor to MountedInputAccessor
2023-11-14 14:02:57 +01:00
Eelco Dolstra
21140c987b
Fix doxygen comments
2023-11-14 14:02:57 +01:00
Eelco Dolstra
4329bdf6a3
Move comment
2023-11-14 14:02:57 +01:00
Eelco Dolstra
25cf8f1071
src/libfetchers/union-input-accessor.cc: Apply suggestion
...
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-11-14 13:57:24 +01:00
Eelco Dolstra
38b07d6347
src/libfetchers/git.cc: Apply suggestion
...
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-11-14 13:38:03 +01:00
Eelco Dolstra
d74d2fdaa7
Move statusCallbackTrampoline
2023-11-14 13:35:26 +01:00
Eelco Dolstra
21bb180547
Use libgit2 with ssh-exec support
...
See https://github.com/libgit2/libgit2/pull/6617 . This ensures that we
get support for ~/.ssh/config, known_hosts etc.
2023-11-14 13:30:51 +01:00
Eelco Dolstra
cf59ea83ec
configure: Check for libgit2
2023-11-10 13:58:59 +01:00
Eelco Dolstra
98a120b8b8
Merge remote-tracking branch 'origin/master' into libgit2
2023-11-09 16:48:41 +01:00
Robert Hensing
1fa87c6aa8
Merge pull request #9283 from obsidiansystems/mememory-source-accessor
...
Factor out `MemorySourceAccessor`, implement missing features
2023-11-06 19:51:02 +01:00
John Ericson
ac89bb064a
Split up util.{hh,cc}
...
All OS and IO operations should be moved out, leaving only some misc
portable pure functions.
This is useful to avoid copious CPP when doing things like Windows and
Emscripten ports.
Newly exposed functions to break cycles:
- `restoreSignals`
- `updateWindowSize`
2023-11-05 12:20:02 -05:00