On Tue, Feb 14, 2017 at 6:09 AM, Stefan Beller <sbeller@xxxxxxxxxx> wrote: >> + >> + if (submodule) { >> + refs->submodule = xstrdup_or_null(submodule); > > drop the _or_null here? > > So in this patch we have either > * submodule set > * or gitdir/gitcommondir set > > which means that we exercise the commondir for regular repos. > In the future when we want to be able to have a combination of worktrees > and submodules this ought to be possible by setting submodule != NULL > and still populating the gitdir/commondir buffers. You probably have seen it by now. In the near future, submodule is completely gone from here. We convert to a .git dir before we pass in here. In a farther future, gitcommondir will be gone too with all the per-worktree logic in this file. A linked worktree consists of two backends actually, one per-worktree (which remains files-based), the other for shared refs, which could be files, lmdb or whatever. Stacking up submodule on top of a linked worktree should not be a problem. -- Duy