git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/4] submodule: fix recursive path printing from non root directory

From
Stefan Beller <sbeller@google.com>
Date
Mar 25, 2016, 16:54 UTC
Message-ID
<CAGZ79kYmVH_6=7y894woObaD4de44d8iUQtcCq6r3grGrMiaxQ@mail.gmail.com>
In-Reply-To
<xmqqy4964if7.fsf@gitster.mtv.corp.google.com>
On Fri, Mar 25, 2016 at 9:43 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 26 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> 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.
>
> tests to demonstrate existing breakage and protect the fix from
> future breakages would be needed, no?

I realize this is worded slightly wrong. The bugs described in patch 1&2 would only occur if we'd apply patch 3 without them. So currently there is no bug.

We currently do have tests for that, e.g. t7403,
 '"git submodule sync" should update submodule URLs - subdirectory'

In patch 4 I added tests for "git submodule update" and enhanced tests for the sync command.

Show 35 quoted lines
>
>>
>> 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/")
>>                               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
>>                       )
Previous: Junio C HamanoNext: Stefan Beller
Message 6 of 23 in “[PATCHv2 0/4] submodule helper: cleanup prefix passing”
  1. Stefan BellerMar 24, 2016
  2. 1/4 submodule: fix recursive path printing from non root directoryStefan Beller, Mar 24, 2016
  3. Jacob KellerMar 24, 2016
  4. Stefan BellerMar 24, 2016
  5. Junio C HamanoMar 25, 2016
  6. Stefan BellerMar 25, 2016
  7. 2/4 submodule: fix recursive execution from non root directoryStefan Beller, Mar 24, 2016
  8. Jacob KellerMar 24, 2016
  9. Junio C HamanoMar 25, 2016
  10. Stefan BellerMar 25, 2016
  11. 3/4 submodule--helper list: lose the extra prefix optionStefan Beller, Mar 24, 2016
  12. Jacob KellerMar 24, 2016
  13. Junio C HamanoMar 25, 2016
  14. Junio C HamanoMar 25, 2016
  15. Junio C HamanoMar 25, 2016
  16. Stefan BellerMar 25, 2016
  17. Stefan BellerMar 25, 2016
  18. Junio C HamanoMar 25, 2016
  19. Stefan BellerMar 25, 2016
  20. Junio C HamanoMar 25, 2016
  21. 4/4 submodule: add more tests for recursive submodule behaviorStefan Beller, Mar 24, 2016
  22. Eric SunshineMar 25, 2016
  23. Stefan BellerMar 25, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.