From 59714a15e0b36c93a7c19b71344a9fccf7b9840d Mon Sep 17 00:00:00 2001 From: Nick Van den Broeck Date: Tue, 11 Jun 2019 13:09:06 +0200 Subject: [PATCH] FuzzyMatching works Fixes #2843 --- src/libexpr/flake/flake.cc | 1 + tests/flakes.sh | 56 +++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index 0018a0d07..30ab9a876 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -104,6 +104,7 @@ static FlakeRef lookupFlake(EvalState & state, const FlakeRef & flakeRef, const auto newRef = j->second; newRef.ref = flakeRef.ref; newRef.rev = flakeRef.rev; + newRef.subdir = flakeRef.subdir; return updateFlakeRef(state, newRef, registries, pastSearches); } } diff --git a/tests/flakes.sh b/tests/flakes.sh index c380b405b..85ba7c8c9 100644 --- a/tests/flakes.sh +++ b/tests/flakes.sh @@ -15,6 +15,7 @@ registry=$TEST_ROOT/registry.json flake1Dir=$TEST_ROOT/flake1 flake2Dir=$TEST_ROOT/flake2 flake3Dir=$TEST_ROOT/flake3 +flake4Dir=$TEST_ROOT/flake4 nonFlakeDir=$TEST_ROOT/nonFlake for repo in $flake1Dir $flake2Dir $flake3Dir $nonFlakeDir; do @@ -101,6 +102,12 @@ cat > $registry < $registry < $flake3Dir/flake.nix < \$out + ''; + }; + }; +} +EOF +git -C $flake3Dir add flake.nix +git -C $flake3Dir commit -m 'Remove packages.xyzzy' +git -C $flake3Dir checkout master + +# Test whether fuzzy-matching works for IsAlias +(! nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy:xyzzy) + +# Test whether fuzzy-matching works for IsGit +(! nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy:xyzzy) +nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy:sth