SZEDER Gbor <szeder@xxxxxxxxxx> wrote: > This enables us to remove code duplications from completion > functions for commands having subcommands. > > Signed-off-by: SZEDER Gábor <szeder@xxxxxxxxxx> > --- > This function does not return the index of the subcommand found on the > command line, which was in the $c variable previously. However, $c was > only used in if statements, like: > if [ $c -eq $COMP_CWORD -a -z "$command" ]; then > __gitcomp "cmd1 cmd2 cmd3" > fi > To my understanding the only(?) purpose of those if statements was to > prevent subcommands appearing again on the list of possible completions, > when there was one already on the command line. But [ -z $command ] is > sufficient to detect those cases, so we can actually omit > [ $c -eq $COMP_CWORD ]. Is it right, or am I missing something? Yup, you understood it correctly. You found a cluster of "copy and paste programming" and I am happy to see it cleaned up. Thanks. -- Shawn. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html