In this patch, foreach --recursive acts depth-first, much like the default
behavior described in the patch by Imram Yousuf in this
post <>.
Changes were made so that the submodule "Entering ..." message was right
next to the output generated by the command too.
It also adds the --parent option for executing the command in the
supermodule as well.

I began by adding a --depth option, to preserve the original --recursive
behavior, and the --parent option, and trying to get that to work. However,
I pretty much confused myself for a while trying to straighten that out, so
I just ended up modifying the --recursive behavior.
If the --recursive behavior should be preserved, I could add the --depth
option back and only have --parent affect non-recursive and --depth
recursive behavior.

I had kind-of implemented this behavior with aliases / bash functions
(posted to pastebin <>
, spurned by a
question I asked in StackOverflow <>),
however I would always run into issues with escaping characters when
passing from the bash functions to git aliases (i.e., putting "'ello" as an
test commit message). I also tried out mb14's method from the StackOverflow
post, but I ran into the same issues.
Figured the best way to avoid that was to cut out the extra layers.

I've attached a test script to generate the tree that VonC suggested with
output showing the iteration.

Attachment: 0001-area-submodules.patch
Description: Binary data

Description: Bourne shell script

Reply via email to