git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Tan <jonathantanmy@google.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: Prathamesh Chavan <pc44800@gmail.com>,
	git@vger.kernel.org, christian.couder@gmail.com,
	gitster@pobox.com, sbeller@google.com
Subject: Re: [PATCH v1 1/5] submodule foreach: correct '$path' in nested submodules from a subdirectory
Date: Tue, 6 Feb 2018 15:00:44 -0800	[thread overview]
Message-ID: <20180206150044.1bffbb573c088d38c8e44bf5@google.com> (raw)
In-Reply-To: <20180206145406.b759164cead02cd3bb3fdce0@google.com>

On Tue, 6 Feb 2018 14:54:06 -0800
Jonathan Tan <jonathantanmy@google.com> wrote:

> > 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.

[snip]

> > +cat >expect <<EOF
> > +Entering '../nested1'
> > +$pwd/clone2-nested1-nested1-$nested1sha1
> > +Entering '../nested1/nested2'
> > +$pwd/clone2/nested1-nested2-nested2-$nested2sha1
> > +Entering '../nested1/nested2/nested3'
> > +$pwd/clone2/nested1/nested2-nested3-nested3-$nested3sha1
> > +Entering '../nested1/nested2/nested3/submodule'
> > +$pwd/clone2/nested1/nested2/nested3-submodule-submodule-$submodulesha1
> > +Entering '../sub1'
> > +$pwd/clone2-foo1-sub1-$sub1sha1
> > +Entering '../sub2'
> > +$pwd/clone2-foo2-sub2-$sub2sha1
> > +Entering '../sub3'
> > +$pwd/clone2-foo3-sub3-$sub3sha1
> > +EOF
> > +
> > +test_expect_success 'test "submodule foreach --recursive" from subdirectory' '
> > +	(
> > +		cd clone2/untracked &&
> > +		git submodule foreach --recursive "echo \$toplevel-\$name-\$sm_path-\$sha1" >../../actual
> > +	) &&
> > +	test_i18ncmp expect actual
> > +'

Wait a minute...this seems like you're using my "third solution". If we
were using either (a) or (b), $sm_path would contain slashes in the case
of nested submodules, right?

  reply	other threads:[~2018-02-06 23:01 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
2018-02-06 23:00     ` Jonathan Tan [this message]
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

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

  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 \
    --in-reply-to=20180206150044.1bffbb573c088d38c8e44bf5@google.com \
    --to=jonathantanmy@google.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pc44800@gmail.com \
    --cc=sbeller@google.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).