You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Line numbers refer to version 1.20151229 (current debian testing)]
The command line argument parsing logic is incorrect and means that hooks that should be called are not called. This occurs when a repo name is included in the command, such as vcsh zsh push.
The problem starts at line 521 where VCSH_COMMAND is set to $1, i.e., the repo name 'zsh'. That means no match is found in the following command-expansion case-block (lines 523-539). For example, if the command is pus the case-block does not expand that to push.
The following if-block (lines 541-620) fails to match VCSH_COMMAND, which is now set to repo name 'zsh', to a git command. It drops through to the elif [ -n "$2" ] branch which sets VCSH_COMMAND to 'run', VCSH_REPO_NAME (correctly) to repo name 'zsh', and the positional parameters to 'git' and 'push'. That means line 659 ($VCSH_COMMAND "$@") becomes run git push. In the 'run()' function this becomes git push.
The fundamental problem with processing this three-item command line is that when vcsh is matching the vcsh command (in the if-block from lines 541-620), the VCSH_COMMAND variable is set to the repo name. While this example uses the 'push' command, the same problem will occur for most other commands.
It is not possible to put a workaround in the 'pre-command' and 'post-command' hooks because the actual vcsh command remains a positional parameter of the vcsh script itself and there is no way for either of these hook scripts to discover it. The vcsh script needs to be fixed to enable the pre- and post-push hooks (and other hooks) to be called.
The text was updated successfully, but these errors were encountered:
Confirmed, this is one of several edge cases where the current argument handling can do the wrong thing. Blindly assigning $VCSH_COMMAND to $1 before checking that it a supported command is wrong, as are a couple latter assumptions that something is a repo name even if one doesn't exist.
#239 will clear up some hook handling issues, but not the core problem described here.
[Line numbers refer to version 1.20151229 (current debian testing)]
The command line argument parsing logic is incorrect and means that hooks that should be called are not called. This occurs when a repo name is included in the command, such as
vcsh zsh push
.The problem starts at line 521 where VCSH_COMMAND is set to $1, i.e., the repo name 'zsh'. That means no match is found in the following command-expansion case-block (lines 523-539). For example, if the command is
pus
the case-block does not expand that topush
.The following if-block (lines 541-620) fails to match VCSH_COMMAND, which is now set to repo name 'zsh', to a git command. It drops through to the
elif [ -n "$2" ]
branch which sets VCSH_COMMAND to 'run', VCSH_REPO_NAME (correctly) to repo name 'zsh', and the positional parameters to 'git' and 'push'. That means line 659 ($VCSH_COMMAND "$@"
) becomesrun git push
. In the 'run()' function this becomesgit push
.The fundamental problem with processing this three-item command line is that when vcsh is matching the vcsh command (in the if-block from lines 541-620), the VCSH_COMMAND variable is set to the repo name. While this example uses the 'push' command, the same problem will occur for most other commands.
It is not possible to put a workaround in the 'pre-command' and 'post-command' hooks because the actual vcsh command remains a positional parameter of the vcsh script itself and there is no way for either of these hook scripts to discover it. The vcsh script needs to be fixed to enable the pre- and post-push hooks (and other hooks) to be called.
The text was updated successfully, but these errors were encountered: