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

Re: [PATCH v2 3/5] git-submodule.sh: Add Custom argument input support to git submodule recurse subcommand

From
Junio C Hamano <gitster@pobox.com>
Date
May 12, 2008, 22:43 UTC
Message-ID
<7v7idzxhwp.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1209978582-5785-3-git-send-email-imyousuf@gmail.com>
imyousuf@gmail.com writes:
Show 24 quoted lines
> From: Imran M Yousuf <imyousuf@smartitengineering.com>
>
> There is a scenario which has been put forward several times in
> discussion over the recurse subcommand and it is that commands chould have
> different arguments for different modules.
>
> For example, one module could want to checkout 'master', while another might want
> to checkout 'work'. The [-a|--customized-argument] argument provides platform
> just for that. Consider the following command and its followup for further info:
>
> 	git submodule recurse -a checkout
>
> 	Submodule b is not initialized and skipped
> 	git submodule recurse a checkout
> 	Please provide an argument: master
> 	Press y to provide another arg...
> 	git checkout master
> 	Already on branch "master"
> 	Submodule d is not initialized and skipped
> 	git submodule recurse . checkout
> 	Please provide an argument: master
> 	Press y to provide another arg...
> 	git checkout master
> 	Already on branch "master"

Is it only me who finds this UI (and the one 4/5 further introduces) somewhat clumsy and extremely ugly?

I am almost tempted to suggest going to the extreme and spawn interactive shell in each repository directory, like this:

    toplevel$ git submodule recurse -a
    (info) Submodule b is not initialized and skipped
    (info) git submodule recurse 'a'
    (info) we now give you a shell in that directory.  Do whatever you
    (info) like and type cntl-D (or "exit") once you are done.
    toplevel/a$ git checkout
    toplevel/a$ exit
    (info) Submodule d is not initialized and skipped
    (info) git submodule recurse '.'
    (info) we now give you a shell in that directory.  Do whatever you
    (info) like and type cntl-D (or "exit") once you are done.
    toplevel/.$ git checkout
    toplevel/.$ exit
    (info) git submodule recurse recursion ended.
    toplevel$
so that the users can do whatever they want there.

If we want a useful and flexible "recurse", perhaps the only thing we need to do is a command that lists a submodule directory path, one path at a time, in optionally different traversal order and depth cutoff, so that the user can feed it to xargs and do whatever they want to run in there.

Previous: imyousuf@gmail.comNext: Johan Herland
Message 6 of 13 in “git-submodule.sh: Add Long Usage instead of simple usage”
  1. 1/5 git-submodule.sh: Add Long Usage instead of simple usageimyousuf@gmail.com, May 5, 2008
  2. 2/5 git-submodule.sh: Add recurse subcommand with basic optionsimyousuf@gmail.com, May 5, 2008
  3. 3/5 git-submodule.sh: Add Custom argument input support to git submodule recurse subcommandimyousuf@gmail.com, May 5, 2008
  4. 4/5 git-submodule.sh: Add pre command argument to git submodule recurse subcommandimyousuf@gmail.com, May 5, 2008
  5. 5/5 Documentation/git-submodule.txt: Add documentation for the recurse subcommandimyousuf@gmail.com, May 5, 2008
  6. Junio C HamanoMay 12, 2008
  7. Johan HerlandMay 18, 2008
  8. Sverre RabbelierMay 18, 2008
  9. Johannes SchindelinMay 18, 2008
  10. Sverre RabbelierMay 18, 2008
  11. Imran M YousufMay 19, 2008
  12. Junio C HamanoMay 12, 2008
  13. Imran M YousufMay 13, 2008

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.