From: Jonathan Tan <email@example.com>
To: Prathamesh Chavan <firstname.lastname@example.org>
Cc: email@example.com, firstname.lastname@example.org,
Subject: Re: [PATCH v1 1/5] submodule foreach: correct '$path' in nested submodules from a subdirectory
Date: Tue, 6 Feb 2018 14:54:06 -0800 [thread overview]
Message-ID: <email@example.com> (raw)
On Fri, 2 Feb 2018 10:27:41 +0530
Prathamesh Chavan <firstname.lastname@example.org> wrote:
> When running 'git submodule foreach' from a subdirectory of your
> repository, nested submodules get a bogus value for $sm_path:
Maybe call it $path for now, since $sm_path starts to be recommended
only in patches after this one.
> For a submodule 'sub' that contains a nested submodule 'nested',
> running 'git -C dir submodule foreach echo $path' would report
Add "from the root of the superproject", maybe?
> path='../nested' for the nested submodule. The first part '../' is
> derived from the logic computing the relative path from $pwd to the
> root of the superproject. The second part is the submodule path inside
> the submodule. This value is of little use and is hard to document.
> There are two different possible solutions that have more value:
> (a) The path value is documented as the path from the toplevel of the
> superproject to the mount point of the submodule.
> In this case we would want to have path='sub/nested'.
> (b) As Ramsay noticed the documented value is wrong. For the non-nested
> case the path is equal to the relative path from $pwd to the
> submodules working directory. When following this model,
> the expected value would be path='../sub/nested'.
A third solution is to use "nested" - that is, the name of the submodule
directory relative to its superproject. (It's currently documented as
"the name of the submodule directory relative to the superproject".)
Having said that, (b) is probably better.
> Both groups can be found in the wild. The author has no data if one group
> outweighs the other by large margin, and offending each one seems equally
> bad at first. However in the authors imagination it is better to go with
> (a) as running from a sub directory sounds like it is carried out
> by a human rather than by some automation task. With a human on
> the keyboard the feedback loop is short and the changed behavior can be
> adapted to quickly unlike some automation that can break silently.
Thanks - this is a good analysis.
> git-submodule.sh | 1 -
> t/t7407-submodule-foreach.sh | 36 ++++++++++++++++++++++++++++++++++--
I think the documentation should be changed too - $path is the name of
the submodule directory relative to the current directory?
next prev parent reply other threads:[~2018-02-06 22:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 4:57 [PATCH v1 0/5] Incremental rewrite of git-submodules Prathamesh Chavan
2018-02-02 4:57 ` [PATCH v1 1/5] submodule foreach: correct '$path' in nested submodules from a subdirectory Prathamesh Chavan
2018-02-06 22:54 ` Jonathan Tan [this message]
2018-02-06 23:00 ` Jonathan Tan
2018-02-06 23:11 ` Stefan Beller
2018-02-02 4:57 ` [PATCH v1 2/5] submodule foreach: document '$sm_path' instead of '$path' Prathamesh Chavan
2018-02-02 4:57 ` [PATCH v1 3/5] submodule foreach: clarify the '$toplevel' variable documentation Prathamesh Chavan
2018-02-02 4:57 ` [PATCH v1 4/5] submodule foreach: document variable '$displaypath' Prathamesh Chavan
2018-02-02 4:57 ` [PATCH v1 5/5] submodule: port submodule subcommand 'foreach' from shell to C Prathamesh Chavan
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:
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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.
Code repositories for project(s) associated with this public inbox
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 read-only IMAP folder(s) and NNTP newsgroup(s).