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

Re: [RFC/PATCH] submodule: add 'exec' option to submodule update

From
Chris Packham <judge.packham@gmail.com>
Date
Jun 29, 2013, 09:11 UTC
Message-ID
<51CEA4B2.1090008@gmail.com>
In-Reply-To
<20130628104243.GD27497@paksenarrion.iveqy.com>
On 28/06/13 22:42, Fredrik Gustafsson wrote:
Show 37 quoted lines
> Hi,
> 
> On Fri, Jun 28, 2013 at 09:53:10PM +1200, Chris Packham wrote:
>> This allows the user some finer grained control over how the update is
>> done. The primary motivation for this was interoperability with stgit
>> however being able to intercept the submodule update process may prove
>> useful for integrating or extending other tools.
>>
>> Signed-off-by: Chris Packham <judge.packham@gmail.com>
>> --
>> Hi,
>>
>> At $dayjob we have a number of users that are accustomed to using stgit.
>> Stgit doesn't play nicely with git rebase which would be the logical
>> setting for submodule.*.update for our usage. Instead we need to run
>> 'stg rebase --merged' on those submodules that have been initialised
>> with stgit.
>>
>> Our current solution is an in-house script which is a poor substitute
>> for git submodule update. I'd much rather replace our script with git
>> submodule update but we do have a requirement to keep stgit for the
>> foreseeable future.  Rather than narrowing in on stgit it seems logical
>> to allow an arbitrary update command to be executed.
>> ---
>>  Documentation/git-submodule.txt |  8 +++++++-
>>  git-submodule.sh                | 22 +++++++++++++++++++++-
>>  2 files changed, 28 insertions(+), 2 deletions(-)
>>
> 
> technically it looks fine to me (except for the lack of tests) but I'm
> not sure I follow the use case.
> 
> In your case, you want to run a script to determinate if that certain
> submodule should use merge or rebase depending on "whatever". And this
> can't be done with git submodule foreach because you want to know the
> sha1 to update to. Have I understood you correctly?
>

Correct. We tend to have submodules that are just normal detached heads which we don't usually touch and others that are actively developed where we would use submodule.x.update=rebase (I personally do) but some developers want to use stgit on those repositories.

Another approach could be to do a 'git pull --no-recurse-submodule' then use 'git submodule foreach script-that-does-the-rebase'. The benefit of the patch I sent is that it can be setup using the config variables[1] and updated the normal way along with the detached HEADs and those using plain git branches.

There may be other use-cases for integration with other tools as well (e.g. something that updates a review tool when commits get rebased).

-- [1] I'm not crazy about the name of submodule.*.update.command but I couldn't think of a better one.

Previous: Fredrik GustafssonNext: Jens Lehmann
Message 4 of 19 in “submodule: add 'exec' option to submodule update”
  1. submodule: add 'exec' option to submodule updateChris Packham, Jun 28, 2013
  2. Stefan NäweJun 28, 2013
  3. Fredrik GustafssonJun 28, 2013
  4. Chris PackhamJun 29, 2013
  5. Jens LehmannJun 30, 2013
  6. Chris PackhamJul 1, 2013
  7. [RFC/PATCHv2] submodule: add ability to configure update commandChris Packham, Jul 1, 2013
  8. Junio C HamanoJul 1, 2013
  9. [RFC/PATCHv3] submodule update: allow custom update commandChris Packham, Jul 2, 2013
  10. Jens LehmannJul 2, 2013
  11. Chris PackhamJul 2, 2013
  12. Jens LehmannJul 3, 2013
  13. Chris PackhamJul 3, 2013
  14. Chris PackhamJul 3, 2013
  15. Junio C HamanoJul 3, 2013
  16. [RFC/PATCHv4] submodule update: allow custom update commandChris Packham, Jul 3, 2013
  17. Junio C HamanoJul 3, 2013
  18. Junio C HamanoJul 1, 2013
  19. Chris PackhamJul 2, 2013

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.