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

Re: [BUG] `git reset --hard` fails with `update = none` submodules

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jun 16, 2021, 00:51 UTC
Message-ID
<YMlLGwScowX8eXeJ@camp.crustytoothpaste.net>
In-Reply-To
<CAKjYmsELpf9r3bAJj_JUHgVegw_7z2KzyuR_6FYYngpC1XmNeg@mail.gmail.com>
On 2021-06-16 at 00:16:06, Rose Kunkel wrote:
Show 10 quoted lines
> # What did you do before the bug happened? (Steps to reproduce your issue)
> 1. Clone a git repository that sets `update = none` in .gitmodules:
> $ git clone --recurse-submodules https://github.com/ubolonton/tree-sitter-langs
> 
> 2. Perform a hard reset:
> $ cd tree-sitter-langs
> $ git reset --hard
> 
> # What did you expect to happen? (Expected behavior)
> The reset should succeed and do nothing.

I think we're in agreement on this. This should be a fresh clone and so a hard reset should change nothing.

Show 6 quoted lines
> # What happened instead? (Actual behavior)
> The reset command fails with
> ```
> fatal: not a git repository: ../../.git/modules/repos/agda
> fatal: could not reset submodule index
> ```
Hmmm, I can't reproduce this behavior.  What I see is this:
  $ git reset --hard
  HEAD is now at 5d362ce Release 0.10.0

I'm running git version 2.32.0.272.g935e593368 on Debian sid (with the experimental packages).

Can you try the clone and run a "git status" command in the repository to see if anything is modified after your clone? Are the submodules checked out when you perform the clone? In my case, I see lines like this:

  Skipping submodule 'repos/agda'

If you're seeing something different, then that might contribute to the different behavior we're seeing.

-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Previous: Rose KunkelNext: Rose Kunkel
Message 2 of 18 in “[BUG] `git reset --hard` fails with `update = none` submodules”
  1. Rose KunkelJun 16, 2021
  2. brian m. carlsonJun 16, 2021
  3. Rose KunkelJun 16, 2021
  4. Rose KunkelJun 16, 2021
  5. Rose KunkelJun 16, 2021
  6. brian m. carlsonJun 16, 2021
  7. Rose KunkelJun 16, 2021
  8. Rose KunkelJun 16, 2021
  9. Junio C HamanoJun 16, 2021
  10. Philippe BlainJun 16, 2021
  11. brian m. carlsonJun 17, 2021
  12. submodule: mark submodules with update=none as inactivebrian m. carlson, Jun 19, 2021
  13. Philippe BlainJun 22, 2021
  14. brian m. carlsonJun 25, 2021
  15. Philippe BlainJun 26, 2021
  16. submodule: mark submodules with update=none as inactivebrian m. carlson, Jul 1, 2021
  17. Philippe BlainJul 9, 2021
  18. brian m. carlsonJul 11, 2021

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.