]> khamidou — GitHub mirrors - arcanist.git/commit
Use getcwd() which is more reliable than $_SERVER['PWD']
authorjungejason <jun.ge.jason@fb.com>
Sat, 24 Dec 2011 07:48:46 +0000 (23:48 -0800)
committerjungejason <jun.ge.jason@fb.com>
Sat, 24 Dec 2011 23:05:13 +0000 (15:05 -0800)
commit6910fd77a4e34bc9e5b1953ee0a9457dbe3dedb8
treec830b844a784bbcabd6773d610f955a20258859b
parentcf00c44cc3b6bd2b41fcf31a4283fceb312c8f90
Use getcwd() which is more reliable than $_SERVER['PWD']

Summary:
in arcanist we are using $_SERVER['PWD'], but in some cases it
is not returning the correct result. For example, when I'm using
PhpStorm (an php IDE) to launch the script, $_SERVER['PWD'] returns the
path of the binary of the IDE:
/home/jungejason/tools/PhpStorm-107.658/bin, not the path where arcanist
is at. getcwd() returns the correct value.

One difference between getcwd() and $_SERVER['PWD'] is that getcwd()
resolves symlink where $_SERVER['PWD'] does not. From what I can see,
using realpath should work.

Test Plan:
* ran arcanist as normal and it worked;
* run arcanist in PhpStorm and it worked.
* created a symlink pointing to the repository inside which
I ran the arc command, and it worked.
* created a symlink pointing to arcanist project, run `.
* resources/shell/bash-completion`  and it worked

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1285
scripts/arcanist.php
src/workflow/shell-complete/ArcanistShellCompleteWorkflow.php