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

Re: [PATCH] submodule status: properly pass options with --recursive

From
Jens Lehmann <jens.lehmann@web.de>
Date
Oct 26, 2012, 19:26 UTC
Message-ID
<508AE3E9.6000304@web.de>
In-Reply-To
<CABURp0op2+QUvusUmAFUxT8s8c02bB9V3=ag9gTTSiiN4t96OA@mail.gmail.com>
Am 26.10.2012 21:07, schrieb Phil Hord:
Show 21 quoted lines
> On Fri, Oct 26, 2012 at 9:15 AM, Jeff King <peff@peff.net> wrote:
>> On Fri, Oct 26, 2012 at 12:20:29AM +0200, Jens Lehmann wrote:
>>
>>> When renaming orig_args to orig_flags in 98dbe63d (submodule: only
>>> preserve flags across recursive status/update invocations) the call site
>>> of the recursive cmd_status was forgotten. At that place orig_args is
>>> still passed into the recursion, which is always empty now. This clears
>>> all options when recursing, as that variable is never set.
>>>
>>> Fix that by renaming orig_args to orig_flags there too and add a test to
>>> catch that bug.
>>
>> Thanks. I back-ported your patch on top of 98dbe63d so it can go to
>> 'maint'. I'm curious, though: why didn't the test right before (which
>> checks recursion for --cached) catch this?
> 
> I was wondering the same thing about why 'git submodule sync
> --recursive --quiet' succeeded, so I checked on it.  The answer is
> that "--quiet" sets GIT_QUIET=1, which is then inherited by the
> recursive call. Indeed, Jens' new test passes even without the
> accompanying fix.  :-\

Dang, you're right! At least that explains why nobody noticed that so far ... (and that's what you get for skipping the "does the test fail without your fix?" part because the fix is so obvious :-( )

Show 14 quoted lines
> The 'status --recursive --cached' test passes for two reasons.  The
> first is that the test is checking for a cached change in a level-1
> submodule, but it is the level-2+ submodules which do not get the
> flags passed down correctly in "$@".  The 2nd reason is that the
> $cached variable is _also_ inherited by the recursive call to
> cmd_status, specifically because it is a call to cmd_status() and not
> to '$SHELL git submodule status', where the latter would have cleared
> the flags at startup, but the former does not.
> 
> I'm a bit wary about "fixing" the flags for the recursion machinery.
> I'm starting to think $orig_flags is moot in almost all cases.  It
> looks like clearing all the flags on each iteration would break 'git
> submodule foreach --recursive --quiet' because it does not use
> $orig_flags at all.  Who knows what other surprises lurk there.

I agree, it looks like ripping out the orig_flags would be the way to go.

Previous: Jeff KingNext: Phil Hord
Message 8 of 12 in “submodule status: properly pass options with --recursive”
  1. submodule status: properly pass options with --recursiveJens Lehmann, Oct 25, 2012
  2. Jeff KingOct 26, 2012
  3. Phil HordOct 26, 2012
  4. t7407: Fix recursive submodule testPhil Hord, Oct 26, 2012
  5. Jens LehmannOct 26, 2012
  6. submodule status: remove unused orig_* variablesJens Lehmann, Oct 28, 2012
  7. Jeff KingOct 29, 2012
  8. Jens LehmannOct 26, 2012
  9. 0/2 Teach --recursive to submodule syncPhil Hord, Oct 26, 2012
  10. 1/2 Teach --recursive to submodule syncPhil Hord, Oct 26, 2012
  11. 2/2 Add tests for submodule sync --recursivePhil Hord, Oct 26, 2012
  12. Jens LehmannOct 28, 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.