git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Imran M Yousuf" <imyousuf@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] git-submodule: rename shell functions for consistency
Date: Wed, 16 Jan 2008 08:26:29 +0600	[thread overview]
Message-ID: <7bfdc29a0801151826u2218f825ga8100b1cc9fa8b2@mail.gmail.com> (raw)
In-Reply-To: <7vy7are3qo.fsf_-_@gitster.siamese.dyndns.org>

Thanks Junio for showing how it should be done. Due to some
pre-scheduled appointment I was unavailable yesterday evening and thus
was neither able to reply nor resubmit the changes.

On Jan 15, 2008 5:18 PM, Junio C Hamano <gitster@pobox.com> wrote:
> This renames the shell functions used in git-submodule that
> implement top-level subcommands.  The rule is that the
> subcommand $foo is implemented by cmd_$foo function.
>
> A noteworthy change is that modules_list() is now known as
> cmd_status().  There is no "submodule list" command.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>
>  * We could probably do something like this.  This first part is
>    about making the command dispatcher maintainable.
>
>    Note that I haven't seriously tested this series.  This and
>    the next one are primarily to illustrate what I think the fix
>    you are trying should look like.
>
>  git-submodule.sh |   20 ++++++++++----------
>  1 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/git-submodule.sh b/git-submodule.sh
> index ad9fe62..3c104e3 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -86,9 +86,9 @@ module_name()
>  #
>  # Clone a submodule
>  #
> -# Prior to calling, modules_update checks that a possibly existing
> +# Prior to calling, cmd_update checks that a possibly existing
>  # path is not a git repository.
> -# Likewise, module_add checks that path does not exist at all,
> +# Likewise, cmd_add checks that path does not exist at all,
>  # since it is the location of a new submodule.
>  #
>  module_clone()
> @@ -121,7 +121,7 @@ module_clone()
>  #
>  # optional branch is stored in global branch variable
>  #
> -module_add()
> +cmd_add()

After reading your reply I was about to suggest renaming module to cmd
but you have done it before I could propose or submit the patch.

>  {
>         repo=$1
>         path=$2
> @@ -174,7 +174,7 @@ module_add()
>  #
>  # $@ = requested paths (default to all)
>  #
> -modules_init()
> +cmd_init()
>  {
>         git ls-files --stage -- "$@" | grep -e '^160000 ' |
>         while read mode sha1 stage path
> @@ -207,7 +207,7 @@ modules_init()
>  #
>  # $@ = requested paths (default to all)
>  #
> -modules_update()
> +cmd_update()
>  {
>         git ls-files --stage -- "$@" | grep -e '^160000 ' |
>         while read mode sha1 stage path
> @@ -266,7 +266,7 @@ set_name_rev () {
>  #
>  # $@ = requested paths (default to all)
>  #
> -modules_list()
> +cmd_status()
>  {
>         git ls-files --stage -- "$@" | grep -e '^160000 ' |
>         while read mode sha1 stage path
> @@ -347,16 +347,16 @@ esac
>
>  case "$add,$init,$update,$status,$cached" in
>  1,,,,)
> -       module_add "$@"
> +       cmd_add "$@"
>         ;;
>  ,1,,,)
> -       modules_init "$@"
> +       cmd_init "$@"
>         ;;
>  ,,1,,)
> -       modules_update "$@"
> +       cmd_update "$@"
>         ;;
>  ,,,*,*)
> -       modules_list "$@"
> +       cmd_status "$@"
>         ;;
>  *)
>         usage
> --
> 1.5.4.rc3.11.g4e67
>
>



-- 
Imran M Yousuf

  reply	other threads:[~2008-01-16  2:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-14  3:22 [PATCH] - git submodule subcommand parsing modified imyousuf
2008-01-15 10:13 ` Junio C Hamano
2008-01-15 11:18   ` [PATCH 1/3] git-submodule: rename shell functions for consistency Junio C Hamano
2008-01-16  2:26     ` Imran M Yousuf [this message]
2008-01-16 20:08       ` Junio C Hamano
2008-01-15 11:19   ` [PATCH 2/3] git-submodule: fix subcommand parser Junio C Hamano
2008-01-15 11:20   ` [PATCH 3/3] git-submodule: add test for the subcommand parser fix Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7bfdc29a0801151826u2218f825ga8100b1cc9fa8b2@mail.gmail.com \
    --to=imyousuf@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).