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

Bug Report: "git submodule deinit" fails right after a clone

From
TBThomas Bétous <th.betous@gmail.com>
Date
Aug 30, 2016, 11:45 UTC
Message-ID
<CAPOqYV+C-P9M2zcUBBkD2LALPm4K3sxSut+BjAkZ9T1AKLEr+A@mail.gmail.com>
Hello,

I found a curious bug in git version 2.9.0.windows.1 (run on Windows 7 via git bash).

If I clone a repository containing submodules and run a "git submodule deinit" on any of the submodules of this repository without executing another git command, this command fails.

For instance:
(let's say the repo MyProject contains 2 submodules: Submodule1 and Submodule2)

$ git clone ssh://****/MyProject [ ... "git clone" output ... ] $ cd MyProject $ git submodule deinit Submodule1 fatal: Please stage your changes to .gitmodules or stash them to proceed Submodule work tree 'Submodule1' contains local modifications; use '-f' to discard them $ git submodule deinit Submodule2 fatal: Please stage your changes to .gitmodules or stash them to proceed Submodule work tree 'Submodule2' contains local modifications; use '-f' to discard them

First the error message is strange. Then what is even stranger is that the error disappears if a "git status" is run before the submodule deinit...

$ git clone ssh://****/MyProject [ ... "git clone" output ... ] $ cd MyProject $ git submodule deinit Submodule1 fatal: Please stage your changes to .gitmodules or stash them to proceed Submodule work tree 'Submodule1' contains local modifications; use '-f' to discard them $ git status [ ... "git status" output ...] $ git submodule deinit Submodule1 Cleared directory 'Submodule1'

I have been able to reproduce this error at least 10 times and with different repositories so I do not think it comes from the state of my repositories. Moreover, the use of "--recursive" argument to the "git clone" command did not change anything.

Are you able to reproduce this problem?
Thank you in advance.
Best regards,
Thomas
Next: Heiko Voigt
Message 1 of 6 in “Bug Report: "git submodule deinit" fails right after a clone”
  1. Thomas BétousAug 30, 2016
  2. Heiko VoigtSep 14, 2016
  3. Thomas BétousOct 4, 2016
  4. Heiko VoigtOct 5, 2016
  5. Heiko VoigtOct 6, 2016
  6. Thomas BétousOct 6, 2016

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.