From: Stefan Beller Date: Thu, 01 Jun 2017 20:36:24 GMT Subject: Re: [PATCH 31/31] ls-files: use repository object Message-ID: In-Reply-To: <20170531214417.38857-32-bmwill@google.com> On Wed, May 31, 2017 at 2:44 PM, Brandon Williams wrote: > Convert ls-files to use a repository struct and recurse submodules > inprocess. > > Signed-off-by: Brandon Williams > +static void show_submodule(const struct repo *superproject, > + struct dir_struct *dir, const char *path) > { > + struct repo submodule; > + char *gitdir = mkpathdup("%s/%s", superproject->worktree, path); > + repo_init(&submodule, gitdir); > + > + repo_read_index(&submodule); > + repo_read_gitmodules(&submodule); > + > + if (superproject->submodule_prefix) > + submodule.submodule_prefix = xstrfmt("%s%s/", superproject->submodule_prefix, path); > + else > + submodule.submodule_prefix = xstrfmt("%s/", path); > + show_files(&submodule, dir); > + > + repo_clear(&submodule); > + free(gitdir); > } I like how it seems easy now to do work in another repository. :) > - { "ls-files", cmd_ls_files, RUN_SETUP | SUPPORT_SUPER_PREFIX }, > + { "ls-files", cmd_ls_files, RUN_SETUP }, With this step, we can get rid of SUPPORT_SUPER_PREFIX eventually. I do not have comments on the patches in the middle, but they cleared up some of the questions that I asked in the early patches. Thanks, Stefan