uses Dir.chdir instead of --git-dir

It is hard to handle special characters appropriately to maintain --git-dir option dynamically.
So repository directory should be given as current directory, instead of command line option.
Dir.chdir-with-block takes effect only in the trailing block.
Limit directory-changing to a single method