Skip to content

nixos/version: fix case where .git is a symlink #78058

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

Merged
merged 1 commit into from
Jan 24, 2020

Conversation

fpletz
Copy link
Member

@fpletz fpletz commented Jan 19, 2020

Motivation for this change

Before c9214c3 and 9d396d2 if .git is symlink the version would gracefully default to no git revision. With those changes, an exception is thrown instead.

This introduces a new function pathIsGitRepo that checks if commitIdFromGitRepo fails without error so we don't have to reimplement this logic again and can fail gracefully.

Things done
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@fpletz fpletz added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 0.kind: regression Something that worked before working no longer labels Jan 19, 2020
@fpletz fpletz requested a review from elseym January 19, 2020 23:50
Copy link
Member

@elseym elseym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks

@ofborg ofborg bot added the 8.has: module (update) This PR changes an existing module in `nixos/` label Jan 19, 2020
Before c9214c3 and
9d396d2 if .git is symlink the version
would gracefully default to no git revision. With those changes an
exception is thrown instead.

This introduces a new function `pathIsGitRepo` that checks if
`commitIdFromGitRepo` fails without error so we don't have to
reimplement this logic again and can fail gracefully.
@fpletz fpletz force-pushed the nixos/version-gitdir-symlink branch from dad866b to 46773a1 Compare January 19, 2020 23:54
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 20, 2020
@fpletz fpletz merged commit 402b97f into NixOS:master Jan 24, 2020
@fpletz fpletz deleted the nixos/version-gitdir-symlink branch January 24, 2020 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: regression Something that worked before working no longer 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants