-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix error handling and return code #35017
Conversation
@qknight: I'm unable to reproduce this, $ nix-prefetch-git https://golang.org/x/net --rev 9831f2c3ac1068a78f50
Initialized empty Git repository in /tmp/git-checkout-tmp-AREolhSA/net-9831f2c/.git/
fatal: https://golang.org/x/net/info/refs not valid: is this a git repository?
fatal: https://golang.org/x/net/info/refs not valid: is this a git repository?
Unable to checkout 9831f2c3ac1068a78f50 from https://golang.org/x/net.
$ echo $?
1
$ You mention Do you have the output without these changes applied, but using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aszlig i've fixed the paste above in the OP. sorry that i pasted the wrong output.
echo 1>&2 "Unable to checkout $hash$ref from $url." | ||
exit 1 | ||
) | ||
exit_status=$(checkout_ref "$hash" "$ref" || checkout_hash "$hash" "$ref") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure if this is the proper solution but it seems to work. can someone confirm this is correct code?
@aszlig i've update the example and you should now be able to see that it is broken and that this PR fixes it. |
What is the status of this pull request? |
Closing due to lack of activity, feel free re-open this if needed. |
Motivation for this change
there is a bug in
nix-prefetch-git
which makes our implementation ofdep2nix
impossible, since the error handling is not working at all.the cause for the problem is that
https://golang.org/x/net
is not a git repository at all and thereforenix-prefetch-git
should fail with an exit code != 0 which is not the case.the output before the change A
the output before the change A (with --quiet)
WARNING: exit code should still be 1 and not 0!
the output after the change B
the output after the change B (with --quiet)
Things done