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())
149
149
*/
150
150
private function initDir ($ gitDir , $ workingDir = null )
151
151
{
152
- $ gitDir = realpath ($ gitDir );
152
+ $ realGitDir = realpath ($ gitDir );
153
153
154
- if (null === $ workingDir && is_dir ($ gitDir .'/.git ' )) {
155
- $ workingDir = $ gitDir ;
156
- $ gitDir = $ gitDir .'/.git ' ;
157
- } elseif (!is_dir ($ gitDir )) {
154
+ if (false === $ realGitDir ) {
158
155
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 ' ;
159
161
}
160
162
161
- $ this ->gitDir = $ gitDir ;
163
+ $ this ->gitDir = $ realGitDir ;
162
164
$ this ->workingDir = $ workingDir ;
163
165
}
164
166
You can’t perform that action at this time.
0 commit comments