From f552a75427f5b34987181511b6016e59797afda5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 12 Aug 2020 00:20:58 +0300 Subject: [PATCH] kiss: Resolve path to root even if in subshell --- kiss | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kiss b/kiss index d42ac30..e2e23d6 100755 --- a/kiss +++ b/kiss @@ -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 "