niv
niv copied to clipboard
handle empty repos
⇒ niv add git --repo https://url/to/empty/repo.git -n myname
Adding package myname
FATAL: Could not read the output of 'git'.
command: git ls-remote --symref https://url/to/empty/repo.git HEAD
Could not read reference and revision from stdout:
This is a bug. Please create a ticket:
https://github.com/nmattia/niv/issues/new
Thanks! I'll buy you a beer.
FATAL: One or more packages failed to update:
nixos-modules: ExitFailure 1
ERROR: ExitFailure 1
@flokli interesting. what do you expect the behavior to be? my guess: an error that is not a "bug" but instead complains that empty repos can't be added (because no revision). Alternatively it could be added as a repo without revision/branch but I'm not sure that's really useful.
Yeah, I was mostly concerned about the case not being properly handled.
git clone
warns the user to have cloned an empty repo, and provides an empty worktree - however, as there's no branch known at that time, it doesn't make sense to add it to sources.json
at all. So niv
should probably just error with an appropriate error message.