carlhuda/bundler — Issue #1489: bundle should ignore GIT_DIR and GIT_WORK_TREE
Author: hannesg
Created: 2011-10-20 08:16:02+00:00
State: open

Following problem:
When I export GIT_DIR or GIT_WORK_TREE before I install some git-gems with bundler it fails.
Example:

```bash
[hag@hannes bundler-nuke]$ export GIT_DIR=bla
[hag@hannes bundler-nuke]$ export GIT_WORK_TREE=bla
[hag@hannes bundler-nuke]$ env | grep GIT
GIT_DIR=bla
GIT_WORK_TREE=bla
[hag@hannes bundler-nuke]$ bundle
Fetching https://hannesg@github.com/hannesg/cautious.git
Password:
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 24 (delta 6), reused 24 (delta 6)
Unpacking objects: 100% (24/24), done.
fatal: Not a git repository: 'bla'
Git error: command `git rev-parse master` in directory /usr/local/rvm/gems/ruby-1.9.2-p290/cache/bundler/git/cautious-fbb660f0d922632431a445e4b9a93fac438a29e0 has failed.
If this error persists you could try removing the cache directory '/usr/local/rvm/gems/ruby-1.9.2-p290/cache/bundler/git/cautious-fbb660f0d922632431a445e4b9a93fac438a29e0'
```

However I think, this behavior is not wanted since these variables may be used for something else.
I think bundler should set the --work-tree and --git-dir options to their default values when interacting with its git repos.