Implement a more correct fix for -X with git worktrees.

Review Request #9874 — Created April 16, 2018 and submitted — Latest diff uploaded

Information

RBTools
release-0.7.x
99fc0a7...

Reviewers

I had previously tried to implement a fix for some problems I had
experienced using rbt post -X, initially pushed as 5f1b920.
Unfortunately, this fix caused some regressions, including a couple
broken unit tests.

Since then, I've narrowed the problem down further to using -X
specifically inside of git worktrees. This indicated to me the actual
bug, which is that GitClient._get_root_directory() was using a
somewhat bogus way of determining the toplevel root of the working tree.
I've changed that to use --show-toplevel instead of --git-dir, which
fixes everything.

  • Ran unit tests.
  • Ran rbt diff -X within a git worktree and saw that files were
    correctly excluded.