Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.3k stars 9.71k forks source link

bump-formula-pr does not honor $EMAIL #5747

Closed bk2204 closed 5 years ago

bk2204 commented 5 years ago

What you were trying to do (and why)

I was trying to bump a version of the git-lfs formula. The email address I use for Git is (as permitted by the documentation) specified in the EMAIL environment variable, not in the Git configuration file. This lets me adjust the configuration in one place in my dotfiles instead of in multiple places.

What happened (include command output)

The Git command to bump the PR fails. It appears that the EMAIL environment variable is not passed through to the Git command, preventing Git from committing.

Command output
  
$ brew bump-formula-pr --strict git-lfs --sha256=245737f6fb2fc3476954329531042f6da1823b86bc13a0b32935bd3bb4ad5397 --url=https://github.com/git-lfs/git-lfs/releases/download/v2.7.0/git-lfs-v2.7.0.tar.gz
Updated 4 taps (homebrew/cask-versions, homebrew/core, homebrew/cask and caskroom/cask).
==> New Formulae
libkeccak                                                                          sha3sum
==> Updated Formulae
imagemagick@6                            overmind                                 phpunit                                  skaffold
==> replace /https:\/\/github\.com\/git\-lfs\/git\-lfs\/releases\/download\/v2\.6\.1\/git\-lfs\-v2\.6\.1\.tar\.gz/ with "https://github.com/git-lfs/git-lfs/releases/
==> replace "df7fcd3a72f3b8916b2d9a591f1435ea7479f397257508c335cb5ba82c040f4a" with "245737f6fb2fc3476954329531042f6da1823b86bc13a0b32935bd3bb4ad5397"
==> Installing or updating 'bundler' gem
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed
Fetching gem metadata from https://rubygems.org/.........
Using ast 2.4.0
Using bundler 2.0.1
Fetching json 2.1.0
Fetching docile 1.3.1
Fetching simplecov-html 0.10.2
Installing docile 1.3.1
Installing json 2.1.0 with native extensions
Fetching tins 1.20.2
Installing simplecov-html 0.10.2
Fetching thor 0.19.4
Installing tins 1.20.2
Installing thor 0.19.4
Fetching diff-lcs 1.3
Installing diff-lcs 1.3
Fetching hpricot 0.8.6
Fetching jaro_winkler 1.5.2
Installing jaro_winkler 1.5.2 with native extensions
Installing hpricot 0.8.6 with native extensions
Fetching mustache 1.1.0
Installing mustache 1.1.0
Fetching parallel 1.13.0
Installing parallel 1.13.0
Fetching parser 2.6.0.0
Installing parser 2.6.0.0
Using powerpack 0.1.2
Using rainbow 3.0.0
Fetching rdiscount 2.2.0.1
Installing rdiscount 2.2.0.1 with native extensions
Fetching rspec-support 3.8.0
Installing rspec-support 3.8.0
Using ruby-progressbar 1.10.0
Fetching unicode-display_width 1.4.1
Installing unicode-display_width 1.4.1
Fetching term-ansicolor 1.7.1
Installing term-ansicolor 1.7.1
Fetching parallel_tests 2.28.0
Installing parallel_tests 2.28.0
Fetching rspec-core 3.8.0
Installing rspec-core 3.8.0
Fetching rspec-expectations 3.8.2
Installing rspec-expectations 3.8.2
Fetching rspec-mocks 3.8.0
Installing rspec-mocks 3.8.0
Fetching rubocop 0.64.0
Installing rubocop 0.64.0
Fetching rspec-retry 0.6.1
Installing rspec-retry 0.6.1
Fetching rspec-its 1.2.0
Installing rspec-its 1.2.0
Fetching rspec 3.8.0
Installing rspec 3.8.0
Fetching rspec-wait 0.0.9
Installing rspec-wait 0.0.9
Fetching ronn 0.7.3
Installing ronn 0.7.3
Fetching simplecov 0.16.1
Installing simplecov 0.16.1
Fetching coveralls 0.8.22
Fetching simplecov-cobertura 1.3.0
Installing simplecov-cobertura 1.3.0
Installing coveralls 0.8.22
Bundle complete! 10 Gemfile dependencies, 33 gems now installed.
Bundled gems are installed into `../../../../usr/local/Homebrew/Library/Homebrew/vendor/bundle`
M       Formula/git-lfs.rb
Switched to a new branch 'git-lfs-2.7.0'

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'bk2204@dis.(none)')
Error: Failure while executing; `git commit --no-edit --verbose --message=git-lfs\ 2.7.0 -- /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/git-lfs.rb` exited with 128.  

  

What you expected to happen

brew bump-formula-pr passes through the EMAIL environment variable (as well as other valid Git configuration environment variables) and honors the way the user chooses to configure Git, and the operation completes successfully.

Step-by-step reproduction instructions (by running brew commands)

$ export EMAIL=$(git config user.email)
$ git config --unset-all user.email
$ brew bump-formula-pr --strict git-lfs --sha256=245737f6fb2fc3476954329531042f6da1823b86bc13a0b32935bd3bb4ad5397 --url=https://github.com/git-lfs/git-lfs/releases/download/v2.7.0/git-lfs-v2.7.0.tar.gz

brew config

$ brew config
HOMEBREW_VERSION: 2.0.1-57-g2ca56f6
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2ca56f6731c2eb793ba28972c9a6688f9cff7f33
Last commit: 9 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5ea5509e1ce88a3660c1443df08f2b7a26aefb71
Core tap last commit: 32 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_LOGS: /Users/bk2204/Library/Logs/Homebrew
HOMEBREW_VISUAL: mvim -f
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.20.0.741 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_202
macOS: 10.14.3-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: N/A

brew doctor

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Homebrew/homebrew-core is not on the master branch

Check out the master branch by running:
  git -C "$(brew --repo homebrew/core)" checkout master
MikeMcQuaid commented 5 years ago

The Git command to bump the PR fails. It appears that the EMAIL environment variable is not passed through to the Git command, preventing Git from committing.

brew intentionally filters all non-whitelisted environment variables. You could either configure this in your .gitconfig or set a HOMEBREW_EMAIL variable locally and submit a PR to assign it back to ENV["EMAIL"] in dev-cmd/bump-formula-pr.rb.

scpeters commented 5 years ago

Note that #5706 was a similar pull request that added a check for the HOMEBREW_DISPLAY variable.