Do not try to change directory when running Phan tests with no params
authorLeszek Manicki <leszek.manicki@wikimedia.de>
Tue, 3 Jan 2017 10:22:05 +0000 (11:22 +0100)
committerLeszek Manicki <leszek.manicki@wikimedia.de>
Tue, 3 Jan 2017 10:22:05 +0000 (11:22 +0100)
When running tests with:
PHAN=/path/to/phan/phan /path/to/mediawiki-core/tests/phan/bin/phan
the script changes to the home dir (does "cd" with no param),
which results in git error message (unless the home dir happens
to be a git repository).

Change-Id: Ib11e419fb5cca51ceaed0e9c7c86ae9c5c4ae0f2

tests/phan/bin/phan

index 6ce1e84..61ad7da 100755 (executable)
@@ -31,7 +31,7 @@ fi
 
 # If the first argument doesn't start with a -, then it's a path
 # to another project (extension, skin, etc.) to analyze
-if [[ "$1" != "-"* ]]; then
+if [[ -n "$1" && "$1" != "-"* ]]; then
        cd $1
        shift
 else