libfetchers: produce a proper error when both ref and rev are set

Affects `github`, `gitlab` and `sourcehut` fetchers.
Previously this was an assertion, which crashed the evaluator
with SIGABRT.

Fixes: #1133
Change-Id: Ia9bb8dd29ac8b9c97bf048827f62c5076a6a6964
This commit is contained in:
Max Siling
2026-02-16 14:25:40 +03:00
parent 9520e663c8
commit f1ce35f53c
3 changed files with 27 additions and 2 deletions
@@ -0,0 +1,9 @@
error:
… while calling the 'fetchTree' builtin
at /pwd/in.nix:3:1:
2| # https://git.lix.systems/lix-project/lix/issues/1133
3| builtins.fetchTree {
| ^
4| type = "github";
error: input 'github:nixos/nixpkgs' has both ref (nixpkgs-unstable) and rev (e4bae1bd10c9c57b2cf517953ab70060a828ee6f), which is not allowed