]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Revert "git: Turn $git_dir into a stack"
authorSimon McVittie <smcv@debian.org>
Mon, 9 Jan 2017 10:53:16 +0000 (10:53 +0000)
committerSimon McVittie <smcv@debian.org>
Wed, 11 Jan 2017 19:55:10 +0000 (19:55 +0000)
Now that we have avoided using in_git_dir recursively, we don't need
the stack any more.

This reverts commit 39b8931ad31fe6b48afdc570caa459a0996c2092.

(cherry picked from commit c29c230c33fa4c4994d979fa4d6fcdf280ee8dc6)

IkiWiki/Plugin/git.pm

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