git's emacs mode automatically finds the root of the worktree, so that
the user doesn't have to. Teach StGit's emacs mode the same trick by
borrowing the git-get-top-dir function from git.
The borrowed code was written by Alexandre Julliard <julliard@winehq.org>.