Re: [PATCH 4/4] clone: allow configurable default for `-o`/`--origin`
Derrick Stolee <stolee@gmail.com> writes:
Show 29 quoted lines
> > static char *option_origin = NULL;
> > +static char *remote_name = "origin";
>
> This patch could have used a prep patch that had all consumers
> of option_origin use remote_name instead, with this adjustment
> to the way to use option_origin:
>
> > - if (!option_origin)
> > - option_origin = "origin";
> > + if (option_origin)
> > + remote_name = option_origin;
> > + else
> > + remote_name = "origin";
>
> Then this patch introducing the config option would have a
> very limited change in the builtin consisting of these two
> hunks:
>
> > static int git_clone_config(const char *k, const char *v, void *cb)
> > {
> > + if (!strcmp(k, "clone.defaultremotename") && !option_origin)
> > + remote_name = xstrdup(v);
> > return git_default_config(k, v, cb);
> > }
> ...
> > if (option_origin)
> > remote_name = option_origin;
> > - else
> > - remote_name = "origin"That's a great idea! Implemented for v2 :)
Sean