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

Re: Re: [RFC v2] submodule: Respect requested branch on all clones

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Jan 7, 2014, 22:38 UTC
Message-ID
<20140107223858.GB10782@sandbox-ub>
In-Reply-To
<20140107194503.GA26583@odin.tremily.us>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
here my current thoughts in a kind of summary email.
On Tue, Jan 07, 2014 at 11:45:03AM -0800, W. Trevor King wrote:
Show 15 quoted lines
> On Tue, Jan 07, 2014 at 08:19:49PM +0100, Francesco Pretto wrote:
> > 2014/1/7 Junio C Hamano <gitster@pobox.com>:
> > > It is not immediately obvious to me why anybody who specifies the
> > > submodule.*.branch variable to say "I want _that_ branch" not to
> > > want to be on that branch but in a detached state, so from that
> > > perspective, submodule.*.attach feels superfluous.
> > 
> > Junio, for what it concerns me I fully support this patch as, IMO, it
> > makes cleaner the role of the property "submodule.<name>.branch".
> 
> No, submodule.<name>.branch is the name of the remote-tracking branch
> for 'update --remote'.  In this patch, I'm using it as a hint for the
> preferred local branch name [1], which I now think was a bad idea.
> After [2], I think that we should just define the preferred local
> branch name explicitly (submodule.<name>.local-branch?).

I am not so sure about that. Having an extra value adds more configuration burden to the user and it also does not help to understand how this feature is supposed to be used.

Even though I was confused in the first place by the remote/local branch switch for this option, after thinking a little bit more about it I think it makes perfect sense to use the branch option as a hint for the local branch.

Let me explain by an example. Suppose we have the following setup:
1. Fast-forward situation
    superproject      submodule
 master PA--------------->A master
                          |
                          B origin/master

Lets say superproject has submodule.submodule.branch=master and submodule.submodule.update=merge.

Doing the initial update which clones results in the submodules master branch being set to the sha1 registered in the superproject.

Now an update to the newest master in submodule is straightforward:
$ git submodule update --remote
2. Direct work situation

The developer start with the same setup as in situation 1 but now directly starts to work in the submodule and creates commit C.

    superproject      submodule
 master PA--------------->A
                          |\
            origin/master B C master

$ git submodule update --remote $ git commit -a -m "update submodule"

gets him this:
    superproject      submodule
        PA--------------->A
         |                |\
         |  origin/master B C
         |                |/
 master PB--------------->D master

Where now both the submodule and the superproject can be directly pushed. If origin/master in the submodule is tracked by master this is actually one command

$ git push --recurse-submodules=on-demand

So with your (Trevors) patch and reusing submodule.<name>.branch using this kind of direct work in submodules is made easy. And wasn't that what people always requested? ;-) Well, at least if you do not use feature branches this makes it easy. But I think that is a good start make the simple things easy first. Then we can later discuss the more complicated ones. It seems to me that is also the case David wants for his emacs/CEDET workflow: Make it easy for the superproject developers to directly push out trivial fixes to the submodule.

And it also seems to me that is want Francesco wants.

One thing is missing though (and I think thats where Francesco came from): What if the developer already has a detached HEAD in the submodule?

How does he attach to a branch? For this we need something similar to Francescos attach/detach or Trevors submodule checkout with Junio's checkout HEAD~0 from here[1].

I am still undecided how we should call it. Because of my
Idea for feature branch support
- -------------------------------

For the branch attaching feature I would also like something that can actually modify .git/config and for me more importantly .gitmodules.

So e.g. if I want to work on a longer lived feature branch in a submodule which I need in a feature branch in the superproject I would do something like this:

$ git submodule checkout --gitmodules --merge -b hv/my-cool-feature

Which should create a local feature branch hv/my-cool-feature in the submodule, checkout that branch and modify .gitmodules (because of --gitmodules) to have submodule.<name>.update=merge, submodule.<name>.branch=hv/my-cool-feature and stage that to the index.

This is a temporary setting so everyone who is working together can update their branches easily. Once finished (with the prove that the big feature in the superproject works) everyone can go and polish the submodule branches, get their changes accepted there first, and then the update/branch setting local for this branch will be dropped. In this workflow these settings never enter a stable branch but are still very useful to transport this information while developing.

Just an idea of a future extension we should keep in mind when designing the command to attach to a branch. But maybe the command to configure this should be completely independent from checkout. I.e.:

git submodule checkout - syncs to a possible update/branch
git submodule attach   - creates a submodule branch and configures
			 update/branch in .git/config or .gitmodules
git submodule detach?  - reverse attach
or maybe --attach and --detach in this scenario could be options to checkout?
Still unsure...
Cheers Heiko
[1] http://article.gmane.org/gmane.comp.version-control.git/240097
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iEYEARECAAYFAlLMggIACgkQjLR3Aoip+rpoMACgpn4XzDD4CvD+HCi8coIlwueP gQUAn1v1BSJ+k8IJT7S/hwtojT+sUmgP =GGTX -----END PGP SIGNATURE-----

Previous: Francesco PrettoNext: Francesco Pretto
Message 29 of 102 in “Introduce git submodule add|update --attach”
  1. Introduce git submodule add|update --attachFrancesco Pretto, Dec 30, 2013
  2. Phil HordDec 31, 2013
  3. Francesco PrettoJan 2, 2014
  4. Junio C HamanoJan 13, 2014
  5. Junio C HamanoJan 2, 2014
  6. Francesco PrettoJan 2, 2014
  7. Francesco PrettoJan 3, 2014
  8. Francesco PrettoJan 3, 2014
  9. submodule: Respect reqested branch on all clonesW. Trevor King, Jan 3, 2014
  10. Heiko VoigtJan 4, 2014
  11. W. Trevor KingJan 4, 2014
  12. Heiko VoigtJan 5, 2014
  13. W. Trevor KingJan 5, 2014
  14. Francesco PrettoJan 5, 2014
  15. [RFC v2] submodule: Respect requested branch on all clonesW. Trevor King, Jan 5, 2014
  16. Heiko VoigtJan 5, 2014
  17. W. Trevor KingJan 5, 2014
  18. Heiko VoigtJan 5, 2014
  19. W. Trevor KingJan 5, 2014
  20. W. Trevor KingJan 6, 2014
  21. W. Trevor KingJan 6, 2014
  22. Heiko VoigtJan 6, 2014
  23. Francesco PrettoJan 6, 2014
  24. Francesco PrettoJan 6, 2014
  25. Junio C HamanoJan 7, 2014
  26. Francesco PrettoJan 7, 2014
  27. W. Trevor KingJan 7, 2014
  28. Francesco PrettoJan 7, 2014
  29. Heiko VoigtJan 7, 2014
  30. Francesco PrettoJan 8, 2014
  31. W. Trevor KingJan 8, 2014
  32. Francesco PrettoJan 8, 2014
  33. Francesco PrettoJan 8, 2014
  34. W. Trevor KingJan 9, 2014
  35. Francesco PrettoJan 9, 2014
  36. W. Trevor KingJan 9, 2014
  37. Jens LehmannJan 9, 2014
  38. W. Trevor KingJan 9, 2014
  39. Jens LehmannJan 9, 2014
  40. W. Trevor KingJan 9, 2014
  41. Jens LehmannJan 9, 2014
  42. W. Trevor KingJan 9, 2014
  43. Heiko VoigtJan 14, 2014
  44. W. Trevor KingJan 14, 2014
  45. Heiko VoigtJan 14, 2014
  46. W. Trevor KingJan 14, 2014
  47. Heiko VoigtJan 14, 2014
  48. W. Trevor KingJan 14, 2014
  49. Heiko VoigtJan 14, 2014
  50. W. Trevor KingJan 14, 2014
  51. Heiko VoigtJan 14, 2014
  52. Francesco PrettoJan 15, 2014
  53. 0/6 submodule: Local branch creation in module_cloneW. Trevor King, Jan 16, 2014
  54. 1/6 submodule: Make 'checkout' update_module explicitW. Trevor King, Jan 16, 2014
  55. Junio C HamanoJan 16, 2014
  56. W. Trevor KingJan 16, 2014
  57. Francesco PrettoJan 16, 2014
  58. W. Trevor KingJan 16, 2014
  59. 2/6 submodule: Document module_clone arguments in commentsW. Trevor King, Jan 16, 2014
  60. 3/6 submodule: Explicit local branch creation in module_cloneW. Trevor King, Jan 16, 2014
  61. Junio C HamanoJan 16, 2014
  62. W. Trevor KingJan 16, 2014
  63. Junio C HamanoJan 16, 2014
  64. W. Trevor KingJan 16, 2014
  65. 4/6 t7406: Just-cloned checkouts update to the gitlinked hash with 'reset'W. Trevor King, Jan 16, 2014
  66. Junio C HamanoJan 16, 2014
  67. W. Trevor KingJan 16, 2014
  68. Junio C HamanoJan 16, 2014
  69. 5/6 t7406: Add explicit tests for head attachement after cloning updatesW. Trevor King, Jan 16, 2014
  70. 6/6 Documentation: Describe 'submodule update' modes in detailW. Trevor King, Jan 16, 2014
  71. Junio C HamanoJan 16, 2014
  72. W. Trevor KingJan 16, 2014
  73. John KeepingJan 16, 2014
  74. W. Trevor KingJan 16, 2014
  75. Junio C HamanoJan 16, 2014
  76. W. Trevor KingJan 17, 2014
  77. 0/4 submodule: Local branch creation in module_cloneW. Trevor King, Jan 26, 2014
  78. 1/4 submodule: Make 'checkout' update_module explicitW. Trevor King, Jan 26, 2014
  79. Eric SunshineJan 27, 2014
  80. W. Trevor KingJan 27, 2014
  81. 2/4 submodule: Document module_clone arguments in commentsW. Trevor King, Jan 26, 2014
  82. 3/4 submodule: Explicit local branch creation in module_cloneW. Trevor King, Jan 26, 2014
  83. 4/4 Documentation: Describe 'submodule update --remote' use caseW. Trevor King, Jan 26, 2014
  84. Philip OakleyJan 16, 2014
  85. W. Trevor KingJan 16, 2014
  86. Francesco PrettoJan 8, 2014
  87. W. Trevor KingJan 9, 2014
  88. Francesco PrettoJan 7, 2014
  89. Heiko VoigtJan 6, 2014
  90. W. Trevor KingJan 6, 2014
  91. Francesco PrettoJan 5, 2014
  92. W. Trevor KingJan 5, 2014
  93. W. Trevor KingJan 5, 2014
  94. Heiko VoigtJan 6, 2014
  95. Junio C HamanoJan 6, 2014
  96. W. Trevor KingJan 6, 2014
  97. Junio C HamanoJan 6, 2014
  98. Francesco PrettoJan 7, 2014
  99. Junio C HamanoJan 7, 2014
  100. W. Trevor KingJan 7, 2014
  101. Junio C HamanoJan 7, 2014
  102. W. Trevor KingJan 7, 2014

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.