diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2020-07-14 20:59:24 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2020-12-22 10:46:00 +0100 |
commit | 629af83b2d86d77305dc994b83f176a377106c3e (patch) | |
tree | 7fce778b26bbbac9a2c53c557511fa941b71e73f /tests | |
parent | 9fab14adbc3810d5cc1f88672fde1eee4358405c (diff) |
Provide a more meaningful error-message for `builtins.fetchGit` if a revision can't be checked out
A common pitfall when using e.g. `builtins.fetchGit` is the `fatal: not
a tree object`-error when trying to fetch a revision of a git-repository
that isn't on the `master` branch and no `ref` is specified.
In order to make clear what's the problem, I added a simple check
whether the revision in question exists and if it doesn't a more
meaningful error-message is displayed:
```
nix-repl> builtins.fetchGit { url = "https://github.com/owner/myrepo"; rev = "<commit not on master>"; }
moderror: --- Error -------------------------------------------------------------------- nix
Cannot find Git revision 'bf1cc5c648e6aed7360448a3745bb2fe4fbbf0e9' in ref 'master' of repository 'https://gitlab.com/Ma27/nvim.nix'! Please make sure that the rev exists on the ref you've specified or add allRefs = true; to fetchGit.
```
Closes #2431
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions