fix: correct arg parsing for git commands

This commit is contained in:
Jose Diaz-Gonzalez committed 2024-03-13 22:21:04 -04:00
1 parent 91c8e62da5
commit e50b941cee
1 file changed
+7
+7
View File
@@ -107,11 +107,18 @@ fi
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
export -n SSH_ORIGINAL_COMMAND export -n SSH_ORIGINAL_COMMAND
exit_code=0 exit_code=0
if [[ $1 =~ git-* ]] || [[ $1 =~ git:* ]]; then
set -f
$0 $SSH_ORIGINAL_COMMAND
exit_code=$?
set +f
else
readarray -t -O "${#ssh_arg_array[@]}" ssh_arg_array < <( printf '%s' "$SSH_ORIGINAL_COMMAND" | xargs -n 1 ) readarray -t -O "${#ssh_arg_array[@]}" ssh_arg_array < <( printf '%s' "$SSH_ORIGINAL_COMMAND" | xargs -n 1 )
set -f set -f
$O "${ssh_arg_array[@]}" $O "${ssh_arg_array[@]}"
exit_code=$? exit_code=$?
set +f set +f
fi
exit $exit_code exit $exit_code
fi fi