setup.c: support multi-checkout repo setup
[gitweb.git] / perl / Git.pm
index 0ba15b9a5648afcd6fc2dad8c095c6ff1967bcc7..b5905ee1ad03fe9973e3cf7d46fa29c5cf184215 100644 (file)
@@ -1277,7 +1277,7 @@ sub _temp_cache {
 
        my $temp_fd = \$TEMP_FILEMAP{$name};
        if (defined $$temp_fd and $$temp_fd->opened) {
-               if (temp_is_locked($name)) {
+               if ($TEMP_FILES{$$temp_fd}{locked}) {
                        throw Error::Simple("Temp file with moniker '" .
                                $name . "' already in use");
                }
@@ -1294,8 +1294,11 @@ sub _temp_cache {
                        $tmpdir = $self->repo_path();
                }
 
+               my $n = $name;
+               $n =~ s/\W/_/g; # no strange chars
+
                ($$temp_fd, $fname) = File::Temp::tempfile(
-                       'Git_XXXXXX', UNLINK => 1, DIR => $tmpdir,
+                       "Git_${n}_XXXXXX", UNLINK => 1, DIR => $tmpdir,
                        ) or throw Error::Simple("couldn't open new temp file");
 
                $$temp_fd->autoflush;