kiss: Resolve path to root even if in subshell

This commit is contained in:
Dylan Araps 2020-08-12 00:20:58 +03:00
parent 64e77c91e5
commit f552a75427
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

7
kiss
View File

@ -1223,7 +1223,12 @@ pkg_updates() {
;;
*)
cd "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null ||:
# Go to the repository's root directory.
cd "$(git rev-parse --show-toplevel)"
# Go to the real root directory if this is a submodule.
git_root=$(git rev-parse --show-superproject-working-tree)
cd "${git_root:-"$PWD"}"
contains "$repos" "$PWD" || {
repos="$repos $PWD "