No need to detect the top-level.
You can type in any subfolder:
git add -u :/
This is short for:
git add -u :(top)
See git glossary:
A pathspec that begins with a colon : has special meaning. In the short form, the leading colon : is followed by zero or more "magic signature" letters (which optionally is terminated by another colon :), and the remainder is the pattern to match against the path.
top: The magic word top (magic signature:
/
) makes the pattern match from the root of the working tree, even when you are running the command from inside a subdirectory.