Web lists-archives.com

Re: [PATCH 35/35] submodule: convert push_unpushed_submodules to take a struct refspec




On 05/15, Ævar Arnfjörð Bjarmason wrote:
> 
> On Mon, May 14 2018, Brandon Williams wrote:
> 
> > Convert 'push_unpushed_submodules()' to take a 'struct refspec' as a
> > parameter instead of an array of 'const char *'.
> > [...]
> > diff --git a/submodule.h b/submodule.h
> > index e5526f6aa..aae0c9c8f 100644
> > --- a/submodule.h
> > +++ b/submodule.h
> > @@ -100,9 +100,10 @@ extern int submodule_touches_in_range(struct object_id *a,
> >  extern int find_unpushed_submodules(struct oid_array *commits,
> >  				    const char *remotes_name,
> >  				    struct string_list *needs_pushing);
> > +struct refspec;
> >  extern int push_unpushed_submodules(struct oid_array *commits,
> >  				    const struct remote *remote,
> > -				    const char **refspec, int refspec_nr,
> > +				    const struct refspec *rs,
> >  				    const struct string_list *push_options,
> >  				    int dry_run);
> >  /*
> 
> Why do you prefer doing this to having this on top?:
>     
>     diff --git a/submodule.h b/submodule.h
>     index aae0c9c8ff..c3f206ce17 100644
>     --- a/submodule.h
>     +++ b/submodule.h
>     @@ -1,5 +1,6 @@
>      #ifndef SUBMODULE_H
>      #define SUBMODULE_H
>     +#include "refspec.h"
>      
>      struct repository;
>      struct diff_options;
>     @@ -100,7 +101,6 @@ extern int submodule_touches_in_range(struct object_id *a,
>      extern int find_unpushed_submodules(struct oid_array *commits,
>                                         const char *remotes_name,
>                                         struct string_list *needs_pushing);
>     -struct refspec;
>      extern int push_unpushed_submodules(struct oid_array *commits,
>                                         const struct remote *remote,
>                                         const struct refspec *rs,

Basically for the reason that stefan pointed out, though in practice I
don't know how much that would actually impact compile times given we
already are including cache.h and a bunch of others everywhere.

-- 
Brandon Williams