Fix permission error when checking branch

Use the directory name instead of calling out to git to determine whether to
select the stable or unstable database.