Re: [PATCHv2 4/4] submodule: add embed-git-dir function
From: Junio C Hamano <hidden>
Date: 2016-11-30 21:10:00
Duy Nguyen [off-list ref] writes:
On Wed, Nov 23, 2016 at 2:22 AM, Stefan Beller [off-list ref] wrote:quoted
+/* + * Migrate the given submodule (and all its submodules recursively) from + * having its git directory within the working tree to the git dir nested + * in its superprojects git dir under modules/. + */ +void migrate_submodule_gitdir(const char *prefix, const char *path, + int recursive)Submodules and worktrees seem to have many things in common. The first one is this. "git worktree move" on a worktree that contains submodules .git also benefits from something like this [1]. I suggest you move this function to some neutral place and maybe rename it to relocate_gitdir() or something.
Yeah, good suggestion (including name; first round used "intern" I had trouble with, then "embed" which was OK-ish, but probably "relocate" is better choice. If anything, what Stefan's series adds is a command to un-embed embedded one).
It probably should take a bit flag instead of "recursive" here. One thing I would need is the ability to tell this function "I have moved all these .git dirs already (because I move whole worktree in one operation), here are the old and new locations of them, fix them up!". In other words, no rename() could be optionally skipped.
Thanks two of you for working well together ;-)