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

should git-subtree ignore submodules?

From
KKKirill Katsnelson <kkm@smartaction.com>
Date
Nov 1, 2016, 19:41 UTC
Message-ID
<183ca87e-1bc0-080c-3d42-87c689b9f62e@smartaction.com>

"git-subtree add" fails to add the subtree into a repository with submodules, reporting that the worktree is not clean, while `git status` says that everything is clean (including submodules). I tracked the problem down to the command "git index HEAD" returning all submodules as having the M status:

$ git diff-index HEAD :160000 160000 d3812c9318c4d0336897fd2d666be908fa1a7953 d3812c9318c4d0336897fd2d666be908fa1a7953 M ext/grpc <snip more submodules> $ git --version git version 2.9.2.windows.1

I worked around the problem in my local copy of git-subtree shell script by adding "--ignore-submodules=all" to the two invocations of `git diff-index` in the ensure_clean() function (direct link <https://github.com/git/git/blob/next/contrib/subtree/git-subtree.sh#L586>).

I am wondering, is this a defect in git-subtree? To my understanding, the command should not care about submodules more than ensuring their worktree is not in the way of new prefix, and that's a separate check. So *even if* the submodule is modified, this should not be a show stopper for "git-subtree add". Or am I missing some subtleties?

  -kkm
Next: David Aguilar
Message 1 of 2 in “should git-subtree ignore submodules?”
  1. Kirill KatsnelsonNov 1, 2016
  2. David AguilarMar 29, 2017

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.