Revert "git: Turn $git_dir into a stack"

Now that we have avoided using in_git_dir recursively, we don't need
the stack any more.

This reverts commit 39b8931ad3.
master
Simon McVittie 2017-01-09 10:53:16 +00:00
parent ca1b06d599
commit c29c230c33
1 changed files with 7 additions and 7 deletions

View File

@ -154,13 +154,13 @@ sub genwrapper {
} }
} }
my @git_dir_stack; my $git_dir=undef;
my $prefix; my $prefix=undef;
sub in_git_dir ($$) { sub in_git_dir ($$) {
unshift @git_dir_stack, shift; $git_dir=shift;
my @ret=shift->(); my @ret=shift->();
shift @git_dir_stack; $git_dir=undef;
$prefix=undef; $prefix=undef;
return @ret; return @ret;
} }
@ -217,13 +217,13 @@ sub safe_git {
chdir $params{chdir} chdir $params{chdir}
or error("cannot chdir to $params{chdir}: $!"); or error("cannot chdir to $params{chdir}: $!");
} }
elsif (! @git_dir_stack) { elsif (! defined $git_dir) {
chdir $config{srcdir} chdir $config{srcdir}
or error("cannot chdir to $config{srcdir}: $!"); or error("cannot chdir to $config{srcdir}: $!");
} }
else { else {
chdir $git_dir_stack[0] chdir $git_dir
or error("cannot chdir to $git_dir_stack[0]: $!"); or error("cannot chdir to $git_dir: $!");
} }
if ($params{stdout}) { if ($params{stdout}) {