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

Re: [PATCH v3 1/3] git-submodule add: Add -r/--record option

From
W. Trevor King <wking@tremily.us>
Date
Nov 10, 2012, 18:44 UTC
Message-ID
<20121110184437.GC2739@mjolnir>
In-Reply-To
<7v390jqlep.fsf@alter.siamese.dyndns.org>
On Thu, Nov 08, 2012 at 11:34:54PM -0800, Junio C Hamano wrote:
Show 17 quoted lines
> "W. Trevor King" <wking@tremily.us> writes:
> 
> > By remaining agnostic on the variable usage, this patch makes
> > submodule setup more convenient for all parties.
> 
> I personally do not think "remaining agnostic on the usage" is a
> good thing, at least for any option to commands at the higher level
> on the stack, such as "git submodule".  I am afraid that giving an
> easier way to set up a variable with undefined semantics may make
> setup more confusing for all parties.  One party gives one specific
> meaning to the field, while another party uses it for something
> slightly different.
> 
> I would not object to "git config submodule.$name.branch $value", on
> the other hand.  "git config" can be used to set a piece of data
> that has specific meaning, but as a low-level tool, it is not
> _limited_ to variables that have defined meaning.
This is what I'm doing now:
  $ git submodule add -b <branch> <repo> <path>
  $ git config --file .gitmodules submodule.<path>.branch <branch>
  $ git submodule foreach 'git checkout $(git config --file $toplevel/.gitmodules submodule.$name.branch) && git pull'
With my second patch (Phil's config export), that becomes
  $ git submodule add -b <branch> <repo> <path>
  $ git config --file .gitmodules submodule.<path>.branch <branch>
  $ git submodule foreach 'git checkout $submodule_branch && git pull'
With my first patch, that becomes
  $ git submodule add -rb <branch> <repo> <path>
  $ git submodule foreach 'git checkout $submodule_branch && git pull'

This seems pretty useful to me, but I'm still using submodule.<name>.branch explicitly as a user, and Git is not interpreting the option directly. Users are free to store whatever they like in that option, and use it however they wish:

  $ git submodule foreach 'do-crazy-stuff.sh $submodule_branch'

If we need a semantic interpretation to justify -r/--record, everyone that's chimed in so far has agreed on the same interpretation. I wouldn't be averse to

  $ git submodule add -rb <branch> <repo> <path>
  $ git submodule pull-branch

which makes the foreach pull logic internal. However, there has been a reasonable amount of resistance to this workflow in the past, so I thought that a patch series that avoided a semantic interpretation would be more acceptable.

If neither an agnostic -r/--record or a semantic pull-branch command are acceptable, I suppose we'll have to drop my first and third patches and only keep the second.

Trevor
-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
Previous: Heiko VoigtNext: W. Trevor King
Message 5 of 49 in “git-submodule add: Add -r/--record option”
  1. 0/3 git-submodule add: Add -r/--record optionW. Trevor King, Nov 9, 2012
  2. 1/3 git-submodule add: Add -r/--record optionW. Trevor King, Nov 9, 2012
  3. Junio C HamanoNov 9, 2012
  4. Heiko VoigtNov 9, 2012
  5. W. Trevor KingNov 10, 2012
  6. W. Trevor KingNov 10, 2012
  7. Heiko VoigtNov 17, 2012
  8. Junio C HamanoNov 11, 2012
  9. W. Trevor KingNov 11, 2012
  10. Heiko VoigtNov 17, 2012
  11. W. Trevor KingNov 17, 2012
  12. Heiko VoigtNov 17, 2012
  13. W. Trevor KingNov 17, 2012
  14. Junio C HamanoNov 20, 2012
  15. W. Trevor KingNov 20, 2012
  16. Junio C HamanoNov 20, 2012
  17. W. Trevor KingNov 20, 2012
  18. Junio C HamanoNov 20, 2012
  19. Heiko VoigtNov 23, 2012
  20. Sascha CunzNov 23, 2012
  21. Heiko VoigtNov 23, 2012
  22. W. Trevor KingNov 23, 2012
  23. W. Trevor KingNov 23, 2012
  24. W. Trevor KingNov 23, 2012
  25. 0/4 git-submodule add: Add --local-branch optionW. Trevor King, Nov 26, 2012
  26. 1/4 git-submodule add: Add --local-branch optionW. Trevor King, Nov 26, 2012
  27. 2/4 git-submodule init: Record submodule.<name>.branch in repository config.W. Trevor King, Nov 26, 2012
  28. Jens LehmannNov 27, 2012
  29. W. Trevor KingNov 28, 2012
  30. 3/4 git-submodule update: Add --branch optionW. Trevor King, Nov 26, 2012
  31. Heiko VoigtNov 27, 2012
  32. W. Trevor KingNov 27, 2012
  33. [RFC] git-submodule update: Add --commit optionW. Trevor King, Nov 29, 2012
  34. W. Trevor KingNov 29, 2012
  35. W. Trevor KingNov 29, 2012
  36. 4/4 Hack fix for 'submodule update does not fetch already present commits'W. Trevor King, Nov 26, 2012
  37. W. Trevor KingNov 27, 2012
  38. Heiko VoigtNov 27, 2012
  39. W. Trevor KingNov 27, 2012
  40. Heiko VoigtNov 27, 2012
  41. W. Trevor KingNov 28, 2012
  42. Phil HordNov 29, 2012
  43. W. Trevor KingNov 27, 2012
  44. Heiko VoigtNov 27, 2012
  45. 2/3 git-submodule foreach: export .gitmodules settings as variablesW. Trevor King, Nov 9, 2012
  46. Heiko VoigtNov 9, 2012
  47. W. Trevor KingNov 10, 2012
  48. 3/3 git-submodule: Motivate --record with an example use caseW. Trevor King, Nov 9, 2012
  49. W. Trevor KingNov 10, 2012

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.