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

Supress git rev-parse error when fetching Git revision #394

Merged
merged 3 commits into from
Feb 25, 2021

Conversation

shalvah
Copy link
Contributor

@shalvah shalvah commented Feb 25, 2021

Pipe stderr from the git rev-parse HEAD to the null device (/dev/null on *nix, NUL on Windows). Also replaced references to /dev/null in the tests with Ruby's FIle::NULL (available since Ruby 1.9), so tests can work on Windows also.

@shalvah shalvah requested a review from joshuap February 25, 2021 20:02
@shalvah
Copy link
Contributor Author

shalvah commented Feb 25, 2021

Tested in these situations:

  • No Git repo: from_git returns nil
  • Git repo but not committed: from_git returns "HEAD"
  • Git repo with commits: from_git returns lastest commit

Copy link
Member

@joshuap joshuap left a comment

Choose a reason for hiding this comment

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

Nice! 👍

@joshuap joshuap merged commit bca1a32 into master Feb 25, 2021
@shalvah shalvah deleted the supress-gitrev-error branch April 2, 2022 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants