Skip to content
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

nix-prefetch-git: propagate errors under --quiet #54543

Merged
merged 1 commit into from Jun 18, 2019

Conversation

thefloweringash
Copy link
Member

@thefloweringash thefloweringash commented Jan 24, 2019

Motivation for this change

nix-prefetch-git with --quiet masks errors. This mode is consumed by scripts, and the failure is often buried several layers deep.

$ nix-prefetch-git https://github.com/sensu/yaml --rev f00f00f00; echo $?
Initialized empty Git repository in /....
[...]
fatal: 'f00f00f00' is not a commit and a branch 'fetchgit' cannot be created from it
Unable to checkout f00f00f00 from https://github.com/sensu/yaml.
1
$ nix-prefetch-git https://github.com/sensu/yaml --rev f00f00f00 --quiet; echo $?
{
  "url": "https://github.com/sensu/yaml",
  "rev": "refs/heads/fetchgit",
  "date": "",
  "sha256": "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5",
  "fetchSubmodules": false
}
0
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@thefloweringash thefloweringash changed the title nix-prefetch-git: propagate errors under --quiet [WIP] nix-prefetch-git: propagate errors under --quiet Jan 24, 2019
@thefloweringash
Copy link
Member Author

thefloweringash commented Jan 24, 2019

This propagates the error on faliure, but critically does not propagate the result values on success 😞 .

Edit: I think this works. Testing and simplifications welcome!

@thefloweringash thefloweringash changed the title [WIP] nix-prefetch-git: propagate errors under --quiet nix-prefetch-git: propagate errors under --quiet Jan 24, 2019
@thefloweringash
Copy link
Member Author

Related: #35017

@Shados
Copy link
Member

Shados commented Jun 18, 2019

I just spent about two hours tracking down an issue that was caused by this. For the love of the next poor bastard who would be stung by it, please merge this sooner rather than later.

@matthewbauer matthewbauer merged commit c08cdfa into NixOS:master Jun 18, 2019
@thefloweringash thefloweringash deleted the git-prefetch-errors branch June 18, 2019 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants