Jeff King [off-list ref] writes:
I think it has to in order to avoid surprises. If I do this:
perl -MGit -e '
my $r = Git->repository;
chdir("/somewhere/else");
$r->git_command(...);
'
that command ought to run in the repository I opened earlier. So I think
to keep the illusion of a lib-ified object, creating that object has to
lock in the path.
But it really seems like we should be asking rev-parse what that path
is, not trying to do any magic ourselves.
Yeah, whichever caller doing the chdir() needs to take the
responsibility of adjusting the future use of git, e.g. going back
to the original before spawning git or whatever.
Or having the original Git->repository call bail out by having "git"
figure out where it is, while honoring safe.directory or any future
protection underlying "git" offers.
Thanks.