Re: [PATCH 31/31] ls-files: use repository object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/01, Stefan Beller wrote:
> On Wed, May 31, 2017 at 2:44 PM, Brandon Williams <bmwill@xxxxxxxxxx> wrote:
> > Convert ls-files to use a repository struct and recurse submodules
> > inprocess.
> >
> > Signed-off-by: Brandon Williams <bmwill@xxxxxxxxxx>
> 
> 
> > +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. :)

It really does make working with another repo easy!  No more compiling
argv options and spawning child processes :D

> 
> > -       { "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.

Yes Ideally most of the little hacks I introduced when originally
teaching ls-files and grep to recurse could be removed.

> 
> 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

-- 
Brandon Williams



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]