From: Stefan Beller <sbeller@google.com>
To: Jacob Keller <jacob.keller@gmail.com>
Cc: Git mailing list <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Duy Nguyen <pclouds@gmail.com>,
Jens Lehmann <Jens.Lehmann@web.de>
Subject: Re: [PATCH 1/4] submodule: fix recursive path printing from non root directory
Date: Thu, 24 Mar 2016 16:44:48 -0700 [thread overview]
Message-ID: <CAGZ79kaDwEhGB7aVVWnZEOgPCm2_yAprroz6Fn37DvLC8vNbfw@mail.gmail.com> (raw)
In-Reply-To: <CA+P7+xqbkK7GKf5=eFVYkBzmrjy9hOsWGTn0W31qWiT-0ZhuPQ@mail.gmail.com>
On Thu, Mar 24, 2016 at 4:38 PM, Jacob Keller <jacob.keller@gmail.com> wrote:
> On Thu, Mar 24, 2016 at 4:34 PM, Stefan Beller <sbeller@google.com> wrote:
>> Recursing into submodules currently works by just calling
>> (cd $submodule && eval <command>) for update, sync and status
>> command.
>>
>> Say you have the following setup
>>
>> repo/ # a superproject repository
>> repo/untracked/ # an untracked dir in repo/
>> repo/sub/ # a submodule
>> repo/sub/subsub # a submodule of a submodule
>>
>> When being in repo/untracked/ and invoking "git submodule status"
>> you would expect output like:
>>
>> repo/untracked/$ git submodule status --recursive
>> <sha1> ../sub (version)
>> <sha1> ../sub/subsub (<version>)
>>
>> We need to take into account that we are in the untracked/ dir,
>> so we need to prepend ../ to the paths. By using relative_path
>> to compute the prefix, we'll have that output.
>>
>> Signed-off-by: Stefan Beller <sbeller@google.com>
>> ---
>> git-submodule.sh | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/git-submodule.sh b/git-submodule.sh
>> index 43c68de..536ba68 100755
>> --- a/git-submodule.sh
>> +++ b/git-submodule.sh
>> @@ -825,7 +825,7 @@ Maybe you want to use 'update --init'?")"
>> if test -n "$recursive"
>> then
>> (
>> - prefix="$prefix$sm_path/"
>> + prefix="$(relative_path $prefix$sm_path)/"
>> clear_local_git_env
>> cd "$sm_path" &&
>> eval cmd_update
>> @@ -1233,13 +1233,13 @@ cmd_sync()
>> then
>> (
>> clear_local_git_env
>> + prefix=$(relative_path "$prefix$sm_path/")
>
> Not really sure why this got moved, but I don't think it hurts
> anything, though we will have prefix defined now regardless of if
> we're recursive or not. But I think that's correct.
"Because we need to move it before the cd". At least I thought so at
the time of writing. That is actually not the case.
At the time of writing this was intertangled with the next patch,
and we need to put the call to relative_path before the reassignment
of wt_prefix as relative_path depends on wt_prefix, which I put at the
same place as the cd in an initial version when coming up with that patch.
In case of a resend, consider this fixed.
>
>> cd "$sm_path"
>> remote=$(get_default_remote)
>> git config remote."$remote".url "$sub_origin_url"
>>
>> if test -n "$recursive"
>> then
>> - prefix="$prefix$sm_path/"
>> eval cmd_sync
>> fi
>> )
>> --
>> 2.8.0.rc4.10.g52f3f33
>>
>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
>
> Regards,
> Jake
next prev parent reply other threads:[~2016-03-24 23:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-24 23:34 [PATCHv2 0/4] submodule helper: cleanup prefix passing Stefan Beller
2016-03-24 23:34 ` [PATCH 1/4] submodule: fix recursive path printing from non root directory Stefan Beller
2016-03-24 23:38 ` Jacob Keller
2016-03-24 23:44 ` Stefan Beller [this message]
2016-03-25 16:43 ` Junio C Hamano
2016-03-25 16:54 ` Stefan Beller
2016-03-24 23:34 ` [PATCH 2/4] submodule: fix recursive execution " Stefan Beller
2016-03-24 23:41 ` Jacob Keller
2016-03-25 16:46 ` Junio C Hamano
2016-03-25 17:27 ` Stefan Beller
2016-03-24 23:34 ` [PATCH 3/4] submodule--helper list: lose the extra prefix option Stefan Beller
2016-03-24 23:44 ` Jacob Keller
2016-03-25 6:28 ` Junio C Hamano
2016-03-25 16:02 ` Junio C Hamano
2016-03-25 17:25 ` Junio C Hamano
2016-03-25 17:31 ` Stefan Beller
2016-03-25 16:49 ` Stefan Beller
2016-03-25 17:01 ` Junio C Hamano
2016-03-25 17:05 ` Stefan Beller
2016-03-25 18:32 ` Junio C Hamano
2016-03-24 23:34 ` [PATCH 4/4] submodule: add more tests for recursive submodule behavior Stefan Beller
2016-03-25 0:25 ` Eric Sunshine
2016-03-25 0:33 ` Stefan Beller
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=CAGZ79kaDwEhGB7aVVWnZEOgPCm2_yAprroz6Fn37DvLC8vNbfw@mail.gmail.com \
--to=sbeller@google.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.keller@gmail.com \
--cc=pclouds@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 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).