Re: [PATCH 1/2] submodule: create helper to build paths to submodule gitdirs
- From
Stefan Beller <sbeller@google.com>
- Date
- Aug 8, 2018, 23:21 UTC
- Message-ID
- <CAGZ79kYvM5hxbe9ZCuFt=Cgv9W0mmdwdFGJz6+DdhPv4UbEXjQ@mail.gmail.com>
- In-Reply-To
- <20180808223323.79989-2-bmwill@google.com>
On Wed, Aug 8, 2018 at 3:33 PM Brandon Williams <bmwill@google.com> wrote:
Show 5 quoted lines
> > Introduce a helper function "submodule_name_to_gitdir()" (and the > submodule--helper subcommand "gitdir") which constructs a path to a > submodule's gitdir, located in the provided repository's "modules" > directory.
Makes sense.
Show 6 quoted lines
> > This consolidates the logic needed to build up a path into a > repository's "modules" directory, abstracting away the fact that > submodule git directories are stored in a repository's common gitdir. > This makes it easier to adjust how submodules gitdir are stored in the > "modules" directory in a future patch.
and yet, all places that we touch were and still are broken for old-style submodules that have their git directory inside the working tree? Do we need to pay attention to those, too?
> diff --git a/git-submodule.sh b/git-submodule.sh > index 8b5ad59bde..053747d290 100755 > --- a/git-submodule.sh > +++ b/git-submodule.sh
Show 6 quoted lines
> @@ -577,7 +578,7 @@ cmd_update()
> die "$(eval_gettext "Unable to find current \${remote_name}/\${branch} revision in submodule path '\$sm_path'")"
> fi
>
> - if ! $(git config -f "$(git rev-parse --git-common-dir)/modules/$name/config" core.worktree) 2>/dev/null
> + if ! $(git config -f "$(git submodule--helper gitdir "$name")/config" core.worktree) 2>/dev/nullThis will collide with origin/sb/submodule-update-in-c specifically 1c866b9831d (submodule--helper: replace connect-gitdir-workingtree by ensure-core-worktree, 2018-08-03), but as that removes these lines, it should be easy to resolve the conflict.