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

Re: [PATCH/RFC 3/3] Teach mv to update the path entry in .gitmodules for moved submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 11, 2013, 16:59 UTC
Message-ID
<7v61ztj94u.fsf@alter.siamese.dyndns.org>
In-Reply-To
<515C89BA.9020806@web.de>
Jens Lehmann <Jens.Lehmann@web.de> writes:
Show 11 quoted lines
> Currently using "git mv" on a submodule moves the submodule's work tree in
> that of the superproject. But the submodule's path setting in .gitmodules
> is left untouched, which is now inconsistent with the work tree and makes
> git commands that rely on the proper path -> name mapping (like status and
> diff) behave strangely.
>
> Let "git mv" help here by not only moving the submodule's work tree but
> also updating the "submodule.<submodule name>.path" setting from the
> .gitmodules file and stage both. This doesn't happen when no .gitmodules
> file is found and only issues a warning when it doesn't have a section for
> this submodule.

Should it happen when the user has other changes to .gitmodules that hasn't been updated to the index?

As this is done in the same final "per-path" loop as adjusting the gitfile links, the worry I expressed in an earlier message about "git mv a/ b/" when "a/x" is a submodule turns out to be unfounded, which is good ;-)

Previous: Ramkumar Ramachandra
Message 14 of 14 in “Teach mv to move submodules”
  1. 0/3 Teach mv to move submodulesJens Lehmann, Apr 3, 2013
  2. 1/3 Teach mv to move submodules together with their work treesJens Lehmann, Apr 3, 2013
  3. Ramkumar RamachandraApr 11, 2013
  4. Junio C HamanoApr 11, 2013
  5. Junio C HamanoApr 11, 2013
  6. 2/3 Teach mv to move submodules using a gitfileJens Lehmann, Apr 3, 2013
  7. Junio C HamanoApr 9, 2013
  8. Jens LehmannApr 10, 2013
  9. 2/3 Teach mv to move submodules using a gitfileJens Lehmann, Apr 10, 2013
  10. Ramkumar RamachandraApr 11, 2013
  11. Junio C HamanoApr 11, 2013
  12. 3/3 Teach mv to update the path entry in .gitmodules for moved submodulesJens Lehmann, Apr 3, 2013
  13. Ramkumar RamachandraApr 11, 2013
  14. Junio C HamanoApr 11, 2013

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.