John Ericson
1fcd3afc38
Fix hashes
2020-06-02 20:35:17 +00:00
John Ericson
c664e68b87
Fix to-base --type handler to correctly set std::optional flag
...
Now that we have a separate flag function, also describe why it is
optional.
2020-06-02 18:25:32 +00:00
John Ericson
c502119fd3
to-base supports parsing SRI hashes, so make type flag optional
2020-06-02 18:05:26 +00:00
John Ericson
d73dbc8e4c
Remove hashingWithUnknownAlgoExits
...
A valid hash type must be provided now. The hash itself can still be
invalid, but that doesn't cause an `abort()`.
2020-06-02 16:28:54 +00:00
John Ericson
64cffb804a
Merge remote-tracking branch 'upstream/master' into no-hash-type-unknown
2020-06-02 16:07:25 +00:00
John Ericson
450dcf2c1b
Remove HashType::Unknown
...
Instead, `Hash` uses `std::optional<HashType>`. In the future, we may
also make `Hash` itself require a known hash type, encoraging people to
use `std::optional<Hash>` instead.
2020-06-02 15:52:13 +00:00
Eelco Dolstra
bfa1acd85c
Merge pull request #3639 from obsidiansystems/do-fixme-store-removes
...
Remove `addToStore` variant as requested by `FIXME`
2020-06-02 15:39:07 +02:00
Eelco Dolstra
c16fdda3a6
Merge branch 'lru-tests' of https://github.com/gilligan/nix
2020-06-02 12:07:48 +02:00
Eelco Dolstra
e9fee8e6a7
src/libutil/tests/lru-cache.cc: Check erase()
...
Co-authored-by: James Lee <jbit@jbit.net>
2020-06-02 12:06:59 +02:00
Tobias Pflug
eca1ff7a9f
Add tests for lru-cache.hh
2020-05-31 01:05:05 +02:00
Nikola Knezevic
fb38459d6e
Ensure we restrict refspec interpretation while fetching
...
As `git fetch` may chose to interpret refspec to it's liking, ensure that we
only pass refs that begin with `refs/` as is, otherwise, prepend them with
`refs/heads`. Otherwise, branches named `heads/foo` (I know it's bad, but it's
allowed), would be fetched as `foo`, instead of `heads/foo`.
2020-05-30 12:33:38 +02:00
Nikola Knezevic
77007d4eab
Improve ref validity checking in fetchGit
...
The previous regex was too strict and did not match what git was allowing. It
could lead to `fetchGit` not accepting valid branch names, even though they
exist in a repository (for example, branch names containing `/`, which are
pretty standard, like `release/1.0` branches).
The new regex defines what a branch name should **NOT** contain. It takes the
definitions from `refs.c` in https://github.com/git/git and `git help
check-ref-format` pages.
This change also introduces a test for ref name validity checking, which
compares the result from Nix with the result of `git check-ref-format --branch`.
2020-05-30 12:29:35 +02:00
John Ericson
fac0c2d54a
Remove addToStore variant as requested by FIXME
...
The idea is it's always more flexible to consumer a `Source` than a
plain string, and it might even reduce memory consumption.
I also looked at `addToStoreFromDump` with its `// FIXME: remove?`, but
the worked needed for that is far more up for interpretation, so I
punted for now.
2020-05-29 17:02:32 -04:00
Carlo Nucera
6dd471ebf6
Fixing the result of merge
2020-05-28 12:14:36 -04:00
Carlo Nucera
4f597fb901
Merge branch 'master' of github.com:NixOS/nix into enum-class
2020-05-28 10:58:22 -04:00
Eelco Dolstra
f60ce4fa20
Merge pull request #3631 from andir/libutil-config-tests
...
Add unit tests for config.cc
2020-05-28 13:51:37 +02:00
Eelco Dolstra
de141fcb79
Merge pull request #3455 from Ericson2314/enum-FileIngestionMethod
...
Replace some `bool recursive` with a new `FileIngestionMethod` enum
2020-05-28 13:50:06 +02:00
John Ericson
0f96f45061
Use FileIngestionMethod
for nix hash
...
There was an enum there that matched in perfectly.
2020-05-27 23:50:11 -04:00
Matthew Bauer
c66441a646
Rename some variables named “recursive” to “method”
...
This is much less confusing since recursive is no longer a boolean.
2020-05-27 13:21:26 -05:00
Matthew Bauer
7873fd175d
Don’t use FileIngestionMethod for StorePathsCommand
...
This is a different recursive than used in makeFixedOutputPath.
2020-05-27 13:21:11 -05:00
Andreas Rammhold
fc137d2f00
config.hh: Add documentation
...
Provides some general overview on the mechanics of Config/Setting and
comments for the public methods of Config.
2020-05-27 17:47:18 +02:00
Andreas Rammhold
9df3d8ccd7
tests/config.cc: add tests for Config::applyConfig
2020-05-27 17:47:18 +02:00
Andreas Rammhold
e1b8c64c04
config.cc: extract parts of applyConfigFile into applyConfig
...
This moves the actual parsing of configuration contents into applyConfig
which applyConfigFile is then going to call. By changing this we can now
test the configuration file parsing without actually create a file on
disk.
2020-05-27 17:47:18 +02:00
Andreas Rammhold
93129cf1dd
Add unit tests for config.cc
2020-05-27 17:47:17 +02:00
Eelco Dolstra
66d3ac94c9
Merge pull request #3621 from gilligan/add-json-tests
...
Add unit tests for "json.hh"
2020-05-27 11:08:12 +02:00
Eelco Dolstra
dae6a267a8
Merge pull request #3625 from gilligan/xml-writer-tests
...
Add unit tests for xml-writer
2020-05-27 11:07:53 +02:00
Carlo Nucera
b90241ceb1
Change remaining bools with FileIngestionMethod
2020-05-26 11:32:41 -04:00
Carlo Nucera
6d73c10041
Merge remote-tracking branch 'origin/master' into enum-FileIngestionMethod
2020-05-26 11:14:08 -04:00
Tobias Pflug
4b388e8431
Add unit tests for xml-writer
2020-05-25 18:34:55 +02:00
Tobias Pflug
c284700867
Add unit tests for "json.hh"
2020-05-25 11:57:45 +02:00
Tobias Pflug
ecc5c90dfc
Add unit tests for hashing functions
2020-05-25 11:50:41 +02:00
Tobias Pflug
a73a820a5d
Add unit testes for url.cc
...
This adds tests for
- parseURL
- percentDecode
- decodeQuery
2020-05-20 16:37:35 +02:00
Eelco Dolstra
5ef64f05e6
Cleanup
2020-05-18 15:50:29 +02:00
Eelco Dolstra
0ed946aa61
Merge branch 'wait-for-builders' of https://github.com/serokell/nix
2020-05-18 13:48:45 +02:00
Alexander Bantyev
183dd28266
Don't lock a user while doing remote builds
2020-05-14 17:00:54 +03:00
Eelco Dolstra
ebc024df22
Show hint how to enable experimental features
2020-05-12 15:47:09 +02:00
Eelco Dolstra
268ecf5b3f
nix: Don't require --experimental-features=nix-command for some subcommands
2020-05-12 15:47:09 +02:00
Domen Kožar
5bdb67c843
Merge pull request #3568 from kolloch/outputHashModeError
...
libstore/build.cc: more explicit error about form of output
2020-05-11 18:14:32 +02:00
Domen Kožar
1d8144e36b
Update src/libstore/build.cc
2020-05-11 18:14:23 +02:00
Benjamin Hipple
146f9c114f
doc: consistently refer to 'fixed-output' with a dash
...
General cleanup that makes it easier to search for the term.
2020-05-09 10:58:43 -04:00
Eelco Dolstra
d3d8186c9c
Merge pull request #3571 from gilligan/nix-unit-testing
...
Add unit tests
2020-05-08 17:02:25 +02:00
Tobias Pflug
181a47d884
Enable toLower umlauts test
...
Update comment and enable the test
2020-05-08 15:13:55 +02:00
Tobias Pflug
2191141274
Enable baseNameOf
test
...
Add note about removal of trailing slashes in the doc comment of
baseNameOf and enabled the test.
2020-05-08 15:07:40 +02:00
Tobias Pflug
e3df9c2a6e
Enable dirOf
test
...
Adjusted the doc comment for `dirOf` to reflect the implementation
behavior.
2020-05-08 15:03:44 +02:00
Eelco Dolstra
5b8883faac
configure: Look for gtest
2020-05-08 12:09:37 +02:00
Eelco Dolstra
ca657525b8
Don't install unit tests
2020-05-08 12:03:27 +02:00
Eelco Dolstra
7898cdb75a
make check: Run unit tests
2020-05-08 11:49:40 +02:00
Eelco Dolstra
72b9d971bc
Fix warning
2020-05-08 11:35:57 +02:00
Eelco Dolstra
7cc7cef950
Move unit tests to sr/libutil/tests, use mk make rules
2020-05-08 11:34:09 +02:00
Alexander Bantyev
772e5db828
Mention build users in the 'waiting for' message
2020-05-08 12:29:00 +03:00