From b5e2ea02980290ed04403d466a39e4602810bb0b Mon Sep 17 00:00:00 2001 From: umherirrender Date: Wed, 27 Feb 2013 19:36:25 +0100 Subject: [PATCH] Do not read /.git if it is a directory On my windows under eclipse with EGit there is a directory named .git, but that gives warning, when read with file_get_contents: Warning: file_get_contents(/.git) [function.file-get-contents]: failed to open stream: Permission denied in \includes\GitInfo.php on line 49 Follow up Ieb79c0b4 Change-Id: I7c3ba323460a2fd3739d3912ee6420aa29311f4f --- includes/GitInfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/GitInfo.php b/includes/GitInfo.php index a0a216ee58..0867cd92bc 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -45,7 +45,7 @@ class GitInfo { */ public function __construct( $dir ) { $this->basedir = "{$dir}/.git"; - if ( is_readable( $this->basedir ) ) { + if ( is_readable( $this->basedir ) && !is_dir( $this->basedir ) ) { $GITfile = file_get_contents( $this->basedir ); if ( strlen( $GITfile ) > 8 && substr( $GITfile, 0, 8 ) === 'gitdir: ' ) { $path = rtrim( substr( $GITfile, 8 ), "\r\n" ); -- 2.20.1