{"thread":{"id":"11548","subject":"[PATCH] Simplified the invocation of command action in submodule","startedAt":"2008-01-09T03:59:00Z","lastAt":"2008-01-10T03:05:20Z","messageCount":12,"participants":["imyousuf@gmail.com","Junio C Hamano","Imran M Yousuf","Johannes Sixt","Lars Hjemli"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"64812","messageId":"1199851140-31853-1-git-send-email-imyousuf@gmail.com","threadId":"11548","inReplyTo":null,"subject":"[PATCH] Simplified the invocation of command action in submodule","fromName":"","fromEmail":"imyousuf@gmail.com","sentAt":"2008-01-09T03:59:00Z","receivedAt":"2008-01-09T03:59:00Z","isPatch":true,"sender":{"key":"imyousuf@gmail.com","avatar":"https://gravatar.com/avatar/fda3c870262849d03c7b9c4d288842e128d6d80769fa7bc2d22731b7597928be?d=mp&s=160"},"body":"From: Imran M Yousuf <imran@smartitengineering.com>\n\n- Simplified the invocation of action.\n- Changed switch case based action invoke rather more direct command\ninvocation. Previously first switch case was used to go through $@ and\ndetermine the action, i.e. add, init, update etc, and second switch case\njust to invoke the action. It is modified to determine the action name in\nthe first case structure instead and later just invoke it.\n\nSigned-off-by: Imran M Yousuf <imyousuf@smartitengineering.com>\n---\n git-submodule.sh |   32 ++++++++++++--------------------\n 1 files changed, 12 insertions(+), 20 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex ad9fe62..8a29382 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -16,6 +16,7 @@ update=\n status=\n quiet=\n cached=\n+command=\n \n #\n # print stuff on stdout unless -q was specified\n@@ -293,20 +294,23 @@ modules_list()\n \tdone\n }\n \n+# command specifies the whole function name since \n+# one of theirs prefix is module not modules\n while test $# != 0\n do\n \tcase \"$1\" in\n \tadd)\n \t\tadd=1\n+\t\tcommand=\"module_$1\"\n \t\t;;\n \tinit)\n-\t\tinit=1\n+\t\tcommand=\"modules_$1\"\n \t\t;;\n \tupdate)\n-\t\tupdate=1\n+\t\tcommand=\"modules_$1\"\n \t\t;;\n \tstatus)\n-\t\tstatus=1\n+\t\tcommand=\"modules_list\"\n \t\t;;\n \t-q|--quiet)\n \t\tquiet=1\n@@ -320,7 +324,7 @@ do\n \t\tbranch=\"$2\"; shift\n \t\t;;\n \t--cached)\n-\t\tcached=1\n+\t\tcommand=\"modules_list\"\n \t\t;;\n \t--)\n \t\tbreak\n@@ -345,20 +349,8 @@ case \"$add,$branch\" in\n \t;;\n esac\n \n-case \"$add,$init,$update,$status,$cached\" in\n-1,,,,)\n-\tmodule_add \"$@\"\n-\t;;\n-,1,,,)\n-\tmodules_init \"$@\"\n-\t;;\n-,,1,,)\n-\tmodules_update \"$@\"\n-\t;;\n-,,,*,*)\n-\tmodules_list \"$@\"\n-\t;;\n-*)\n+if [ -z $command ]; then \n \tusage\n-\t;;\n-esac\n+else\n+\t\"$command\" \"$@\"\n+fi\n-- \n1.5.3.7\n"},{"id":"64824","messageId":"7vsl17l8bi.fsf@gitster.siamese.dyndns.org","threadId":"11548","inReplyTo":"1199851140-31853-1-git-send-email-imyousuf@gmail.com","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-09T08:19:45Z","receivedAt":"2008-01-09T08:19:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"imyousuf@gmail.com writes:\n\n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index ad9fe62..8a29382 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -16,6 +16,7 @@ update=\n>  status=\n>  quiet=\n>  cached=\n> +command=\n\nDoesn't the patch make some if not all of the above variables\nunused?\n\n>  \tcase \"$1\" in\n>  \tadd)\n>  \t\tadd=1\n> +\t\tcommand=\"module_$1\"\n>  \t\t;;\n>  \tinit)\n> -\t\tinit=1\n> +\t\tcommand=\"modules_$1\"\n>  \t\t;;\n\nDoes the remaining code still use $add?\n"},{"id":"64825","messageId":"7bfdc29a0801090023s437b681ak435f4e31ee649b72@mail.gmail.com","threadId":"11548","inReplyTo":"7vsl17l8bi.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Imran M Yousuf","fromEmail":"imyousuf@gmail.com","sentAt":"2008-01-09T08:23:51Z","receivedAt":"2008-01-09T08:23:51Z","isPatch":true,"sender":{"key":"imyousuf@gmail.com","avatar":"https://gravatar.com/avatar/fda3c870262849d03c7b9c4d288842e128d6d80769fa7bc2d22731b7597928be?d=mp&s=160"},"body":"Hi Junio,\n\nFirstly, $add is still used later in the code.\nSecondly, yes the variables should be deleted. Will make the change\nand send the patch again; I forgot to clean the unused variables from\nthe declaration, sorry.\n\nBest regards,\n\nImran\n\nOn Jan 9, 2008 2:19 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> imyousuf@gmail.com writes:\n>\n> > diff --git a/git-submodule.sh b/git-submodule.sh\n> > index ad9fe62..8a29382 100755\n> > --- a/git-submodule.sh\n> > +++ b/git-submodule.sh\n> > @@ -16,6 +16,7 @@ update=\n> >  status=\n> >  quiet=\n> >  cached=\n> > +command=\n>\n> Doesn't the patch make some if not all of the above variables\n> unused?\n>\n> >       case \"$1\" in\n> >       add)\n> >               add=1\n> > +             command=\"module_$1\"\n> >               ;;\n> >       init)\n> > -             init=1\n> > +             command=\"modules_$1\"\n> >               ;;\n>\n> Does the remaining code still use $add?\n>\n\n\n\n-- \nImran M Yousuf\n"},{"id":"64831","messageId":"47848CDD.7050806@viscovery.net","threadId":"11548","inReplyTo":"1199851140-31853-1-git-send-email-imyousuf@gmail.com","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-01-09T08:59:09Z","receivedAt":"2008-01-09T08:59:09Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"imyousuf@gmail.com schrieb:\n> @@ -16,6 +16,7 @@ update=\n>  status=\n>  quiet=\n>  cached=\n> +command=\n>\n>  #\n>  # print stuff on stdout unless -q was specified\n> @@ -293,20 +294,23 @@ modules_list()\n>  \tdone\n>  }\n>\n> +# command specifies the whole function name since\n> +# one of theirs prefix is module not modules\n>  while test $# != 0\n>  do\n>  \tcase \"$1\" in\n>  \tadd)\n>  \t\tadd=1\n> +\t\tcommand=\"module_$1\"\n>  \t\t;;\n>  \tinit)\n> -\t\tinit=1\n> +\t\tcommand=\"modules_$1\"\n>  \t\t;;\n>  \tupdate)\n> -\t\tupdate=1\n> +\t\tcommand=\"modules_$1\"\n>  \t\t;;\n>  \tstatus)\n> -\t\tstatus=1\n> +\t\tcommand=\"modules_list\"\n>  \t\t;;\n>  \t-q|--quiet)\n>  \t\tquiet=1\n> @@ -320,7 +324,7 @@ do\n>  \t\tbranch=\"$2\"; shift\n>  \t\t;;\n>  \t--cached)\n> -\t\tcached=1\n> +\t\tcommand=\"modules_list\"\n\nDon't remove cached=1 because otherwise --cached is effectively ignored.\n\n>  \t\t;;\n>  \t--)\n>  \t\tbreak\n> @@ -345,20 +349,8 @@ case \"$add,$branch\" in\n>  \t;;\n>  esac\n>\n> -case \"$add,$init,$update,$status,$cached\" in\n> -1,,,,)\n> -\tmodule_add \"$@\"\n> -\t;;\n> -,1,,,)\n> -\tmodules_init \"$@\"\n> -\t;;\n> -,,1,,)\n> -\tmodules_update \"$@\"\n> -\t;;\n> -,,,*,*)\n> -\tmodules_list \"$@\"\n> -\t;;\n> -*)\n> +if [ -z $command ]; then\n>  \tusage\n> -\t;;\n> -esac\n> +else\n> +\t\"$command\" \"$@\"\n> +fi\n\n- Previously 'git submodule' was equvalent to 'git submodule status', now\nit is an error.\n\n- Previously, passing --cached to add, init, or update was an error, now\nit is not.\n\n-- Hannes\n"},{"id":"64832","messageId":"7bfdc29a0801090107j292eeaf5u2b49651ed23ca783@mail.gmail.com","threadId":"11548","inReplyTo":"47848CDD.7050806@viscovery.net","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Imran M Yousuf","fromEmail":"imyousuf@gmail.com","sentAt":"2008-01-09T09:07:59Z","receivedAt":"2008-01-09T09:07:59Z","isPatch":true,"sender":{"key":"imyousuf@gmail.com","avatar":"https://gravatar.com/avatar/fda3c870262849d03c7b9c4d288842e128d6d80769fa7bc2d22731b7597928be?d=mp&s=160"},"body":"I already saw that mistake Johannes, thank you for pointing it out.\n\nOn Jan 9, 2008 2:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> imyousuf@gmail.com schrieb:\n>\n> > @@ -16,6 +16,7 @@ update=\n> >  status=\n> >  quiet=\n> >  cached=\n> > +command=\n> >\n> >  #\n> >  # print stuff on stdout unless -q was specified\n> > @@ -293,20 +294,23 @@ modules_list()\n> >       done\n> >  }\n> >\n> > +# command specifies the whole function name since\n> > +# one of theirs prefix is module not modules\n> >  while test $# != 0\n> >  do\n> >       case \"$1\" in\n> >       add)\n> >               add=1\n> > +             command=\"module_$1\"\n> >               ;;\n> >       init)\n> > -             init=1\n> > +             command=\"modules_$1\"\n> >               ;;\n> >       update)\n> > -             update=1\n> > +             command=\"modules_$1\"\n> >               ;;\n> >       status)\n> > -             status=1\n> > +             command=\"modules_list\"\n> >               ;;\n> >       -q|--quiet)\n> >               quiet=1\n> > @@ -320,7 +324,7 @@ do\n> >               branch=\"$2\"; shift\n> >               ;;\n> >       --cached)\n> > -             cached=1\n> > +             command=\"modules_list\"\n>\n> Don't remove cached=1 because otherwise --cached is effectively ignored.\n>\n> >               ;;\n> >       --)\n> >               break\n> > @@ -345,20 +349,8 @@ case \"$add,$branch\" in\n> >       ;;\n> >  esac\n> >\n> > -case \"$add,$init,$update,$status,$cached\" in\n> > -1,,,,)\n> > -     module_add \"$@\"\n> > -     ;;\n> > -,1,,,)\n> > -     modules_init \"$@\"\n> > -     ;;\n> > -,,1,,)\n> > -     modules_update \"$@\"\n> > -     ;;\n> > -,,,*,*)\n> > -     modules_list \"$@\"\n> > -     ;;\n> > -*)\n> > +if [ -z $command ]; then\n> >       usage\n> > -     ;;\n> > -esac\n> > +else\n> > +     \"$command\" \"$@\"\n> > +fi\n>\n> - Previously 'git submodule' was equvalent to 'git submodule status', now\n> it is an error.\n>\n> - Previously, passing --cached to add, init, or update was an error, now\n> it is not.\n>\n> -- Hannes\n>\n\n\n\n-- \nImran M Yousuf\nEntrepreneur & Software Engineer\nSmart IT Engineering\nDhaka, Bangladesh\nEmail: imran@smartitengineering.com\nMobile: +880-1711402557\n"},{"id":"64833","messageId":"4784909E.2000205@viscovery.net","threadId":"11548","inReplyTo":"7bfdc29a0801090107j292eeaf5u2b49651ed23ca783@mail.gmail.com","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-01-09T09:15:10Z","receivedAt":"2008-01-09T09:15:10Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"-- Hannes\n\nof them.\n\"that mistake\" with no clue on which one you mean when I pointed out three\nBTW, on this list we don't top-post. In particular not when you write only\n\nImran M Yousuf schrieb:\n> I already saw that mistake Johannes, thank you for pointing it out.\n> \n> On Jan 9, 2008 2:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>> imyousuf@gmail.com schrieb:\n>>\n[...]\n"},{"id":"64834","messageId":"7bfdc29a0801090151k22d3cd5aqedb0d4860868d4d9@mail.gmail.com","threadId":"11548","inReplyTo":"47848CDD.7050806@viscovery.net","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Imran M Yousuf","fromEmail":"imyousuf@gmail.com","sentAt":"2008-01-09T09:51:50Z","receivedAt":"2008-01-09T09:51:50Z","isPatch":true,"sender":{"key":"imyousuf@gmail.com","avatar":"https://gravatar.com/avatar/fda3c870262849d03c7b9c4d288842e128d6d80769fa7bc2d22731b7597928be?d=mp&s=160"},"body":"On Jan 9, 2008 2:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> imyousuf@gmail.com schrieb:\n>\n> > @@ -16,6 +16,7 @@ update=\n> >  status=\n> >  quiet=\n> >  cached=\n> > +command=\n> >\n> >  #\n> >  # print stuff on stdout unless -q was specified\n> > @@ -293,20 +294,23 @@ modules_list()\n> >       done\n> >  }\n> >\n> > +# command specifies the whole function name since\n> > +# one of theirs prefix is module not modules\n> >  while test $# != 0\n> >  do\n> >       case \"$1\" in\n> >       add)\n> >               add=1\n> > +             command=\"module_$1\"\n> >               ;;\n> >       init)\n> > -             init=1\n> > +             command=\"modules_$1\"\n> >               ;;\n> >       update)\n> > -             update=1\n> > +             command=\"modules_$1\"\n> >               ;;\n> >       status)\n> > -             status=1\n> > +             command=\"modules_list\"\n> >               ;;\n> >       -q|--quiet)\n> >               quiet=1\n> > @@ -320,7 +324,7 @@ do\n> >               branch=\"$2\"; shift\n> >               ;;\n> >       --cached)\n> > -             cached=1\n> > +             command=\"modules_list\"\n>\n> Don't remove cached=1 because otherwise --cached is effectively ignored.\n>\n> >               ;;\n> >       --)\n> >               break\n> > @@ -345,20 +349,8 @@ case \"$add,$branch\" in\n> >       ;;\n> >  esac\n> >\n> > -case \"$add,$init,$update,$status,$cached\" in\n> > -1,,,,)\n> > -     module_add \"$@\"\n> > -     ;;\n> > -,1,,,)\n> > -     modules_init \"$@\"\n> > -     ;;\n> > -,,1,,)\n> > -     modules_update \"$@\"\n> > -     ;;\n> > -,,,*,*)\n> > -     modules_list \"$@\"\n> > -     ;;\n> > -*)\n> > +if [ -z $command ]; then\n> >       usage\n> > -     ;;\n> > -esac\n> > +else\n> > +     \"$command\" \"$@\"\n> > +fi\n>\n> - Previously 'git submodule' was equvalent to 'git submodule status', now\n> it is an error.\n\nYes, I forgot to add that status is the default command. Thanks for\npointing it out.\n\n>\n> - Previously, passing --cached to add, init, or update was an error, now\n> it is not.\n\nThe usage statement and this behaviour is rather contradicting. The\nusage says that --cached can be used with all commands; so I am not\nsure whether using --cached with add should be an error or not. IMHO,\nif the previous implementation was right than the USAGE has to be\nchanged, and if the previous implementation was incorrect, than if the\ndefault command is set to status than current implementation is right.\n\nI would like to get comment on this until I fix the patch and resend it.\n\n>\n> -- Hannes\n>\n\nThank you,\n\n-- \nImran M Yousuf\n"},{"id":"64835","messageId":"47849B60.2060000@viscovery.net","threadId":"11548","inReplyTo":"7bfdc29a0801090151k22d3cd5aqedb0d4860868d4d9@mail.gmail.com","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-01-09T10:01:04Z","receivedAt":"2008-01-09T10:01:04Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Imran M Yousuf schrieb:\n> On Jan 9, 2008 2:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>> - Previously, passing --cached to add, init, or update was an error, now\n>> it is not.\n> \n> The usage statement and this behaviour is rather contradicting. The\n> usage says that --cached can be used with all commands; so I am not\n> sure whether using --cached with add should be an error or not. IMHO,\n> if the previous implementation was right than the USAGE has to be\n> changed, and if the previous implementation was incorrect, than if the\n> default command is set to status than current implementation is right.\n\nI prefer that the usage statement lists one line per sub-command with the\nflags that apply only to the sub-command. IOW, a usage statement that\nsuggests that a flag applies to all sub-commands when in reality it\ndoesn't is bogus, IMHO.\n\n-- Hannes\n"},{"id":"64836","messageId":"7bfdc29a0801090206q61150a37i9a4d778a2d416c32@mail.gmail.com","threadId":"11548","inReplyTo":"47849B60.2060000@viscovery.net","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Imran M Yousuf","fromEmail":"imyousuf@gmail.com","sentAt":"2008-01-09T10:06:07Z","receivedAt":"2008-01-09T10:06:07Z","isPatch":true,"sender":{"key":"imyousuf@gmail.com","avatar":"https://gravatar.com/avatar/fda3c870262849d03c7b9c4d288842e128d6d80769fa7bc2d22731b7597928be?d=mp&s=160"},"body":"On Jan 9, 2008 4:01 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Imran M Yousuf schrieb:\n> > On Jan 9, 2008 2:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> >> - Previously, passing --cached to add, init, or update was an error, now\n> >> it is not.\n> >\n> > The usage statement and this behaviour is rather contradicting. The\n> > usage says that --cached can be used with all commands; so I am not\n> > sure whether using --cached with add should be an error or not. IMHO,\n> > if the previous implementation was right than the USAGE has to be\n> > changed, and if the previous implementation was incorrect, than if the\n> > default command is set to status than current implementation is right.\n>\n> I prefer that the usage statement lists one line per sub-command with the\n> flags that apply only to the sub-command. IOW, a usage statement that\n> suggests that a flag applies to all sub-commands when in reality it\n> doesn't is bogus, IMHO.\n>\n\nI think for this patch I will keep the usage intact and keep the\nimplementation coherent with the current usage and add a comment in\nthat place so that if required it can be changed in future.\n\n> -- Hannes\n>\n>\n\n\n\n-- \nImran M Yousuf\n"},{"id":"64837","messageId":"8c5c35580801090224l1e30df6cw5d3fefe99c0cdd7@mail.gmail.com","threadId":"11548","inReplyTo":"7bfdc29a0801090151k22d3cd5aqedb0d4860868d4d9@mail.gmail.com","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Lars Hjemli","fromEmail":"lh@elementstorage.no","sentAt":"2008-01-09T10:24:23Z","receivedAt":"2008-01-09T10:24:23Z","isPatch":true,"sender":{"key":"lh@elementstorage.no","avatar":null},"body":"On Jan 9, 2008 10:51 AM, Imran M Yousuf <imyousuf@gmail.com> wrote:\n> On Jan 9, 2008 2:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> >\n> > - Previously, passing --cached to add, init, or update was an error, now\n> > it is not.\n>\n> The usage statement and this behaviour is rather contradicting. The\n> usage says that --cached can be used with all commands; so I am not\n> sure whether using --cached with add should be an error or not. IMHO,\n> if the previous implementation was right than the USAGE has to be\n> changed, and if the previous implementation was incorrect, than if the\n> default command is set to status than current implementation is right.\n>\n> I would like to get comment on this until I fix the patch and resend it.\n\n--cached only makes sense for the status subcommand, so the\nusage/manpage probably should have looked like this (except for the\nwhitespace mangling...):\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex cffc6d4..331e806 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -10,7 +10,10 @@ SYNOPSIS\n --------\n [verse]\n 'git-submodule' [--quiet] [-b branch] add <repository> [<path>]\n-'git-submodule' [--quiet] [--cached] [status|init|update] [--] [<path>...]\n+'git-submodule' [--quiet] [--cached] [status] [--] [<path>...]\n+'git-submodule' [--quiet] init [--] [<path>...]\n+'git-submodule' [--quiet] update [--] [<path>...]\n+\n\n\n COMMANDS\n-- \n1.5.3.7.1141.g4eb39\n"},{"id":"64838","messageId":"7vsl17i99r.fsf@gitster.siamese.dyndns.org","threadId":"11548","inReplyTo":"47849B60.2060000@viscovery.net","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-09T10:27:28Z","receivedAt":"2008-01-09T10:27:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Imran M Yousuf schrieb:\n>> On Jan 9, 2008 2:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n>>> - Previously, passing --cached to add, init, or update was an error, now\n>>> it is not.\n>> \n>> The usage statement and this behaviour is rather contradicting. The\n>> usage says that --cached can be used with all commands; so I am not\n>> sure whether using --cached with add should be an error or not. IMHO,\n>> if the previous implementation was right than the USAGE has to be\n>> changed, and if the previous implementation was incorrect, than if the\n>> default command is set to status than current implementation is right.\n>\n> I prefer that the usage statement lists one line per sub-command with the\n> flags that apply only to the sub-command. IOW, a usage statement that\n> suggests that a flag applies to all sub-commands when in reality it\n> doesn't is bogus, IMHO.\n\nI view the usage emitted by a command primarily as a quick\nreminder for people who are _already_ familiar with the command\nto help \"was the option this command takes --foo or --bar?  I\ncan never remember which X-<\" situation.  The usage string is\nnot a replacement of the manual page.  For that reason, I\ngenerally prefer short and sweet one line usage for the whole\ncommand, even if it does not exactly capture mutually\nincompatible option combinations, _as long as_ the command\nitself is simple enough.\n\nAs you said, however, git-submodule is a command dispatcher on\nits own, and what its subcommands do are quite different, to the\npoint that they probably should not even be sharing the option\nparser.  One line per subcommand feels more appropriate.\n\nBy the way, Imran, if the current implementation declares a\ncombination of \"add\" and \"--cached\" an error, and a new\nimplementation does not, that's called a regression.  Unless you\ncan prove that the combination makes sense and the existing\nbehaviour is a bug, in which case you can say the new\nimplementation fixes the bug.\n\nIn this case, module_add does not even pay attention to $cached\nin the existing code.  The choice is between (1) silently ignore\nuser's expectation that \"add --cached\" would do something\ndifferent from \"add\" without \"--cached\", or (2) tell the user\nthat the combination does not make sense and error out.  To\npeople who _know_ what the command does, the choice between the\ntwo does not make much difference (they do not give ignored\noption, nor trigger the error), but to new people the latter is\noften easier to use.\n"},{"id":"64894","messageId":"7bfdc29a0801091905k1ef9285em170b26a332a30535@mail.gmail.com","threadId":"11548","inReplyTo":"8c5c35580801090224l1e30df6cw5d3fefe99c0cdd7@mail.gmail.com","subject":"Re: [PATCH] Simplified the invocation of command action in submodule","fromName":"Imran M Yousuf","fromEmail":"imyousuf@gmail.com","sentAt":"2008-01-10T03:05:20Z","receivedAt":"2008-01-10T03:05:20Z","isPatch":true,"sender":{"key":"imyousuf@gmail.com","avatar":"https://gravatar.com/avatar/fda3c870262849d03c7b9c4d288842e128d6d80769fa7bc2d22731b7597928be?d=mp&s=160"},"body":"On Jan 9, 2008 4:24 PM, Lars Hjemli <lh@elementstorage.no> wrote:\n> On Jan 9, 2008 10:51 AM, Imran M Yousuf <imyousuf@gmail.com> wrote:\n> > On Jan 9, 2008 2:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> > >\n> > > - Previously, passing --cached to add, init, or update was an error, now\n> > > it is not.\n> >\n> > The usage statement and this behaviour is rather contradicting. The\n> > usage says that --cached can be used with all commands; so I am not\n> > sure whether using --cached with add should be an error or not. IMHO,\n> > if the previous implementation was right than the USAGE has to be\n> > changed, and if the previous implementation was incorrect, than if the\n> > default command is set to status than current implementation is right.\n> >\n> > I would like to get comment on this until I fix the patch and resend it.\n>\n> --cached only makes sense for the status subcommand, so the\n> usage/manpage probably should have looked like this (except for the\n> whitespace mangling...):\n>\n> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\n> index cffc6d4..331e806 100644\n> --- a/Documentation/git-submodule.txt\n> +++ b/Documentation/git-submodule.txt\n> @@ -10,7 +10,10 @@ SYNOPSIS\n>  --------\n>  [verse]\n>  'git-submodule' [--quiet] [-b branch] add <repository> [<path>]\n> -'git-submodule' [--quiet] [--cached] [status|init|update] [--] [<path>...]\n> +'git-submodule' [--quiet] [--cached] [status] [--] [<path>...]\n> +'git-submodule' [--quiet] init [--] [<path>...]\n> +'git-submodule' [--quiet] update [--] [<path>...]\n> +\n>\n\nThis change makes a lot sense. Thus I will make sure that it is used\nin this manner :). Thanks a lot for clarifying it Lars. I wanted to\nknow what is the purpose of '--'? If it is simply meant to be a\nseparator than fine; else I would be grateful if you would please\nexplain its purpose, so that I do not again implement wrongly :).\n\n>\n>  COMMANDS\n> --\n> 1.5.3.7.1141.g4eb39\n>\n\n\n-- \nImran M Yousuf\n"}]}