Don't fail running virtualenv inside of a git hook

Review Request #3945 - Created May 29, 2016 and submitted

Eric Ayers
benjyw, gmalmquist, molsen, stuhood

There were instances when the detection of GIT_ROOT failed. Now we check GIT_HOOK in the environment, and if it is true, just assume that the script is already running at the root of the repo.

Manually tested by:
- running git commit from different directories in the repo after a git clean -fdx.
- running the virtualenv command from different working directories.
- running pants-release -n

Used to fail running git commit -a on the command line after a git clean with the following error:

Checking packages
Checking imports

./build-support/virtualenv: line 10: /Users/zundel/Src/pants/build-support/build-support/ No such file or directory

Failed to create venv.

To fix import sort order, run `build-support/bin/ -f`

CI is green at


  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Stu Hood
Eric Ayers
Garrett Malmquist
Stu Hood
Eric Ayers
Review request changed

Status: Closed (submitted)

Change Summary:

Thanks Stu & Garrett. Commit 224b2ec

Stu Hood

@Eric: heads up... there was a merge/squash snaffu on master, and this one was temporarily reverted. I cherry-picked it back in as cb18f87f6e4fcead8b568d556698d3c526bbdf8d

  1. Thanks.