From: Petr Baudis <pasky@suse.cz>
To: Mark Levedahl <mlevedahl@gmail.com>
Cc: gitster@pobox.com, git@vger.kernel.org, johan@herland.net
Subject: Re: [PATCH] git-submodule - Add 'foreach' subcommand
Date: Mon, 11 Aug 2008 12:23:45 +0200 [thread overview]
Message-ID: <20080811102344.GG32184@machine.or.cz> (raw)
In-Reply-To: <1218409804-1556-1-git-send-email-mlevedahl@gmail.com>
Hi,
On Sun, Aug 10, 2008 at 07:10:04PM -0400, Mark Levedahl wrote:
> submodule foreach <command-list> will execute the list of commands in
> each currently checked out submodule directory. The list of commands
> is arbitrary as long as it is acceptable to sh. The variables '$path'
> and '$sha1' are availble to the command-list, defining the submodule
> path relative to the superproject and the submodules's commitID as
> recorded in the superproject (this may be different than HEAD in the
> submodule).
in principle, this looks pretty sensible.
> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
> index bf33b0c..1e7d352 100644
> --- a/Documentation/git-submodule.txt
> +++ b/Documentation/git-submodule.txt
> @@ -14,6 +14,7 @@ SYNOPSIS
> 'git submodule' [--quiet] init [--] [<path>...]
> 'git submodule' [--quiet] update [--init] [--] [<path>...]
> 'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
> +'git submodule' foreach <command-list>
>
>
> DESCRIPTION
But as visible here, this is a little bit inconsistent. I think
foreach should be by default verbose about which submodules does it
recurse into - this is what you want in case of casual usage on
command-line. In case you want to have full control on the output within
a script, you can always pass the extra --quiet and it's less obnoxious
this way around.
I also have a problem with the <command-list> - is this one argument?
Multiple arguments? The semantics is ill-defined. If it is supposed to
be a single argument, please drop the -list bit; silent DWIMmery of
using "$@" internally is acceptable, I guess. If it is supposed to be
multiple arguments, you need to
(i) Specify that as <command>... instead
(ii) Either have an eternal annoyance about insane behaviour
here, or use something better than eval "$@". Since
git submodule foreach cp x\ y z
will simply _not_ work properly.
So I think it's best to just drop the 'list' part. You're just
evaluating a shell expression passed in a parameter.
> @@ -123,6 +124,20 @@ summary::
> in the submodule between the given super project commit and the
> index or working tree (switched by --cached) are shown.
>
> +foreach::
> + Executes an arbitrary list of commands in each checked out submodule.
I think "evaluates" is a better word here, too.
--
Petr "Pasky" Baudis
The next generation of interesting software will be done
on the Macintosh, not the IBM PC. -- Bill Gates
next prev parent reply other threads:[~2008-08-11 10:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-10 16:44 [PATCH] git-submodule - Add 'foreach' subcommand Mark Levedahl
2008-08-10 22:22 ` Johan Herland
2008-08-10 22:37 ` Junio C Hamano
2008-08-10 23:10 ` Mark Levedahl
2008-08-11 6:28 ` Balazs Nagy
2008-08-11 10:08 ` Johannes Schindelin
2008-08-11 10:11 ` Matthias Kestenholz
2008-08-11 10:23 ` Petr Baudis [this message]
2008-08-11 20:40 ` Junio C Hamano
2008-08-12 1:45 ` [PATCH] git-submodule foreach - Include output and clarify usage Mark Levedahl
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=20080811102344.GG32184@machine.or.cz \
--to=pasky@suse.cz \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johan@herland.net \
--cc=mlevedahl@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.