Fix checking for the same name in tree

Summary: This cost me a segfault in HPHP, broken HPHP after restart, installing nginx, php-fpm, xhprof and several hours of my time.

Test Plan: Displayed a diff with file named '0' without segfault and timeout.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4352