Fix `Git.detect_worktree` to fail gracefully.

Review Request #1903 - Created March 11, 2015 and submitted

Information
John Sirois
pants
jsirois/issues/1242
1242, 1243
4a34bcd...
Reviewers
pants-reviews
dturner-tw, jcohen, stuhood, wickman, Yasumoto
Previously if there was no git executable on the path this method
would fail instead of returning `None`.  The upshot was that pants could
not be used outside a git repository.

This also makes `Git.detect_worktree` symmetric with `Git.__init__`,
allowing the git binary name/path to be passed in directly.

 src/python/pants/scm/git.py             | 25 +++++++++++++++++++------
 tests/python/pants_test/scm/test_git.py | 33 ++++++++++++++++++++++++++++++++-
 2 files changed, 51 insertions(+), 7 deletions(-)
CI went green here:
  https://travis-ci.org/pantsbuild/pants/builds/54137201
John Sirois
Joshua Cohen
John Sirois
David Turner
John Sirois
Joshua Cohen
Joe Smith
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...