Fix gitfs regression

This was introduced when I added the gitfs whitelists feature recently.
If the base environment is requested, it will not be matched since the
branch name is passed to the _get_tree_* functions.
Merge pull request #10917 from terminalmage/fix-gitfs-regression

Fix gitfs regression