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

Re: [RFC PATCH v3 2/2] t7406: add test for non-default branch in submodule

From
Eddy Petrișor <eddy.petrisor@gmail.com>
Date
Apr 19, 2018, 06:07 UTC
Message-ID
<CAK0XTWecZASWULXYXGauV5WKhYinD7HXyXSTJntocQt3vzr4AA@mail.gmail.com>
In-Reply-To
<CAGZ79kbT+AnVu-AJ9=OSt=Z2ErM5ocfoLfgx=qmHFfbnkqJqwg@mail.gmail.com>
2018-04-05 0:41 GMT+03:00 Stefan Beller <sbeller@google.com>:
Show 6 quoted lines
> On Wed, Apr 4, 2018 at 1:37 PM, Eddy Petrișor <eddy.petrisor@gmail.com> wrote:
>
>>> you plan to later submit as one patch including both the change as well as
>>> the test.
>>
>> Yes,

I did not forget about having a single patch. Will do it once the details are ironed out.

Show 20 quoted lines
>>>>> +       cd ../super5 &&
>>>>> +       echo super_with_2_chained_modules > super5 &&
>>>>> +       git add super5 &&
>>>>> +       test_tick &&
>>>>> +       git commit -m "commit on default branch in super5" &&
>>>>> +       git submodule add ../submodl1b1 submodl1b1 &&
>>>>> +       git config -f .gitmodules submodule."submodl1b1".branch b1 &&
>>>>> +       git add .gitmodules &&
>>>>> +       test_tick &&
>>>>> +       git commit -m "add l1 module with branch b1 in super5" &&
>>>
>>> now we do this again without the nested submodule, just one repo
>>> as a submodule?
>>
>> My intention was to have super5 -> submodl1b1@b1 -> submodl2b2@b2 on
>> the "server" side.
>> But are you saying I just implemented super5 -> sbmodl1b1@master due
>> to the previous master checkout in submodl1b1?
>
> No. I was a little confused about the code.

Actually you were 100% correct. In order to link to submodl1b1@b1 I had to move the master branch checkout after the submobl2@b2 is added.

Otherwise the submodule is added with the last commit on master, not the last one on b1 an b2, respectively.

I suspect that in the tests, because the "server side" repos are local, the git fetch-by-sha1/cloning by hash will be done correctly, without the need of a branch hint, but the problem will still exist for servers such as github which do not support fetch-by-sha1. In case I realize that a server-side repo that doesn't support fetch-by-sha1 is needed, is there a mechanism to set that up in the test case, or do I have to rethink my approach?

Show 11 quoted lines
>>>>> +       git submodule init submodl1b1 &&
>>>>> +       git clone super5 super &&
>>>
>>> does super exist here already? (I did not check, but IIRC
>>> super and super{1-4} are there as we count upwards to
>>> find a name that is ok.
>>
>> I created it in the first step of the test with the intention to have
>> super5 as the "server" and "super" as the client clone.
>
> oh, ok.

After using test_pause I realized 'super' is left over by some other test cases, so in my v4 (unjustifibly) long series I switch to using super_w because I was getting all sorts of issues and wanted to not interfere with the other tests.

>> As a general idea for a test, does it look sane?
>
> Yes, I think it is a sane approach. Thanks for writing such a test!
OK, thanks for the feedback.
Show 6 quoted lines
>> Do you think I should I start with a just one level of submodule with
>> a non-default branch (super -> l1@b1), or it this OK?
>> In my view, having 2 levels makes sure the recursive part is also
>> addressed and verified.
>
> I totally agree.
-- 
Eddy Petrișor
Previous: Eddy PetrișorNext: Stefan Beller
Message 28 of 29 in “Re: [RFC PATCH] git-submodule.sh:cmd_update: if submodule branch exists, fetch that instead of default”
  1. Jonathan NiederMar 6, 2018
  2. Eddy PetrișorMar 8, 2018
  3. Eddy PetrișorMar 8, 2018
  4. Thomas GummererMar 16, 2018
  5. Eric SunshineMar 16, 2018
  6. Thomas GummererMar 17, 2018
  7. Eric SunshineMar 18, 2018
  8. Stefan BellerMar 26, 2018
  9. Fwd: [RFC PATCH] git-submodule.sh:cmd_update: if submodule branch exists, fetch that instead of defaultEddy Petrișor, Mar 29, 2018
  10. Eddy PetrișorMar 29, 2018
  11. 1/2 git-submodule.sh:cmd_update: if submodule branch exists, fetch that instead of defaultEddy Petrișor, Apr 3, 2018
  12. 2/2 t7406: add test for non-default branch in submoduleEddy Petrișor, Apr 3, 2018
  13. Eddy PetrișorApr 3, 2018
  14. Stefan BellerApr 4, 2018
  15. Eddy PetrișorApr 4, 2018
  16. Stefan BellerApr 4, 2018
  17. 1/9 git-submodule.sh:cmd_update: if submodule branch exists, fetch that instead of defaultEddy Petrișor, Apr 18, 2018
  18. 2/9 t7406: add test for non-default branch in submoduleEddy Petrișor, Apr 18, 2018
  19. 3/9 fixup:t7406: use test_commit instead of echo/add/commit as suggested by Stefan BellerEddy Petrișor, Apr 18, 2018
  20. 5/9 fixup:t7406:cleanup chained submodules after test is doneEddy Petrișor, Apr 18, 2018
  21. 4/9 fixup:t7404:use 'git -C' instead of cd .. && gitEddy Petrișor, Apr 18, 2018
  22. 6/9 fixup:t7406:don't call init after add, is redundantEddy Petrișor, Apr 18, 2018
  23. 7/9 fixup:t7406:supr5 commit is done before submodules chainingEddy Petrișor, Apr 18, 2018
  24. 9/9 fixup:t7406:change branches in submodules after the link is doneEddy Petrișor, Apr 18, 2018
  25. 8/9 fixup:t7406:use super_w instead of the existing superEddy Petrișor, Apr 18, 2018
  26. Stefan BellerApr 18, 2018
  27. Eddy PetrișorApr 19, 2018
  28. Eddy PetrișorApr 19, 2018
  29. Stefan BellerApr 19, 2018

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.