Simplify gitdir detection.
Simplify untracked detection.
Simplify stash detection.
Remove usage of dirname in _lp_upwards_find()