Skip to content

Commit 77a1310

Browse files
mmcclimongitster
authored andcommitted
Git.pm: add semicolon after catch statement
When attempting to initialize a repository object in an unsafe directory, a syntax error is reported (Can't use string as a HASH ref while strict refs in use). Fix this runtime error by adding the required semicolon after the catch statement. Without the semicolon, the result of the following line (i.e., the result of Cwd::abs_path) is passed as the third argument to Error.pm's catch function. That function expects that its third argument, $clauses, is a hash reference, and trying to access a string as a hash reference is a fatal error. [1] https://lore.kernel.org/git/20221011182607.f1113fff-9333-427d-ba45-741a78fa6040@korelogic.com/ Reported-by: Hank Leininger <[email protected]> Signed-off-by: Michael McClimon <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3dcec76 commit 77a1310

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

perl/Git.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ sub repository {
217217
} catch Git::Error::Command with {
218218
# Mimic git-rev-parse --git-dir error message:
219219
throw Error::Simple("fatal: Not a git repository: $dir");
220-
}
220+
};
221221

222222
$opts{Repository} = Cwd::abs_path($dir);
223223
}

0 commit comments

Comments
 (0)