Skip to content

Commit 155f270

Browse files
committed
Avoid global
1 parent b947aa8 commit 155f270

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

commands/list

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ EOF
1616
exit 1
1717
fi
1818

19-
EXIT=0
20-
2119
tree() {
2220
local KEY SUB DIR URL NAME BRANCH CONNECT i
2321

@@ -57,6 +55,8 @@ tree() {
5755
fi
5856
fi
5957

58+
local EXIT=0
59+
6060
for ((i = 0; i < ${#KEYS[@]}; ++i)); do
6161
SUB=${KEYS[$i]}
6262
SUB="${SUB%.path}"
@@ -75,14 +75,16 @@ tree() {
7575
URL="$(git config --file .gitmodules --get "submodule.requires/$KEY.url" || \
7676
git config --file .gitmodules --get "submodule.equipment/$KEY.url")"
7777

78-
tree "$DIR/.gitmodules" requires "$PREFIX" "$TURN" "$DIR ($URL)"
78+
if ! tree "$DIR/.gitmodules" requires "$PREFIX" "$TURN" "$DIR ($URL)"; then
79+
EXIT=1
80+
fi
7981
else
8082
EXIT=1
8183
echo "$PREFIX${TURN}$SUB" $'\033[31;1m── submodule missing\033[0m'
8284
fi
8385
done
86+
87+
return $EXIT
8488
}
8589

8690
tree .gitmodules 'requires|equipment' '' '├─' ''
87-
88-
exit $EXIT

0 commit comments

Comments
 (0)