niv icon indicating copy to clipboard operation
niv copied to clipboard

handle empty repos

Open flokli opened this issue 4 years ago • 2 comments

⇒  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 avatar Dec 21 '19 16:12 flokli

@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.

nmattia avatar Dec 22 '19 10:12 nmattia

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.

flokli avatar Dec 22 '19 10:12 flokli