From: Sean Barag Date: Mon, 28 Sep 2020 16:04:57 GMT Subject: Re: [PATCH 4/4] clone: allow configurable default for `-o`/`--origin` Message-ID: <20200928160457.3412744-1-sean@barag.org> In-Reply-To: <0739858e-83f1-3b3f-aba0-7549e7e47cfc@gmail.com> Derrick Stolee writes: > > 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