git submodule foreach --recursive no longer works properly

Created on 13 Jun 2019  路  3Comments  路  Source: git-for-windows/git

  • [x] I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.22.0.windows.1
cpu: x86_64
built from commit: d003d728ffa6c0006da875ec6318d3f6b28a4ddb
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.18362.116]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: VIM
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
Enable Builtin Interactive Add: Disabled

  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

N/A

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash, CMD

git submodule foreach --recursive git clean -dxff
  • What did you expect to occur after running these commands?

Proper running of the git clean -dxff command for each submodule

  • What actually happened instead?

Error message

$ git submodule foreach --recursive git clean -dxff
Entering 'src/lib/opennurbs'
error: unknown switch `d'
usage: git submodule--helper foreach [--quiet] [--recursive] [--] <command>

    -q, --quiet           Suppress output of entering each submodule command
    --recursive           Recurse into nested submodules

fatal: run_command returned non-zero status while recursing in the nested submodules of src/lib/opennurbs
.
  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

Happens with all repositories tested.

  • Additional note

The command works with the form git submodule foreach --recursive "git clean -dxff", but that seems to be an undocumented change from git version 2.21.0.windows.1, where the form git submodule foreach --recursive git clean -dxff still worked as expected.

Most helpful comment

It seems this was caused in upstream git in commit a282f5a. A fix seems to be in the in the making.

All 3 comments

It seems this was caused in upstream git in commit a282f5a. A fix seems to be in the in the making.

It entered next already as https://github.com/git/git/commit/30db18b148c4951deb2c870b5243fb5b18ecb5ed, which means that it is on track to be included in the next major version of Git.

@jesterKing feel free to install Git for Windows' SDK, then build an initial Git with sdk build git, then sdk cd git and cherry-pick this fix, then test, and open a PR.

(If this is too dense an explanation how to continue, please do not hesitate to ask for help.)

The fix made it into git v2.22.1 and newer, so I'll assume this is working now.

Was this page helpful?
0 / 5 - 0 ratings