File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -149,16 +149,18 @@ public function __construct($dir, $options = array())
149149 */
150150 private function initDir ($ gitDir , $ workingDir = null )
151151 {
152- $ gitDir = realpath ($ gitDir );
152+ $ realGitDir = realpath ($ gitDir );
153153
154- if (null === $ workingDir && is_dir ($ gitDir .'/.git ' )) {
155- $ workingDir = $ gitDir ;
156- $ gitDir = $ gitDir .'/.git ' ;
157- } elseif (!is_dir ($ gitDir )) {
154+ if (false === $ realGitDir ) {
158155 throw new InvalidArgumentException (sprintf ('Directory "%s" does not exist or is not a directory ' , $ gitDir ));
156+ } else if (!is_dir ($ realGitDir )) {
157+ throw new InvalidArgumentException (sprintf ('Directory "%s" does not exist or is not a directory ' , $ realGitDir ));
158+ } elseif (null === $ workingDir && is_dir ($ realGitDir .'/.git ' )) {
159+ $ workingDir = $ realGitDir ;
160+ $ realGitDir = $ realGitDir .'/.git ' ;
159161 }
160162
161- $ this ->gitDir = $ gitDir ;
163+ $ this ->gitDir = $ realGitDir ;
162164 $ this ->workingDir = $ workingDir ;
163165 }
164166
You can’t perform that action at this time.
0 commit comments