On Mon, Mar 18, 2013 at 06:46:13PM +0530, Ramkumar Ramachandra wrote:
> +struct remote *remote_get(const char *name)
> +{
> + int name_given = 0;
> +
> + read_config();
> + if (name)
> + name_given = 1;
> + else {
> + name = default_remote_name;
> + name_given = explicit_default_remote_name;
> + }
> + return remote_get_1(name, name_given);
> +}
> +
> +struct remote *pushremote_get(const char *name)
> +{
> + int name_given = 0;
> +
> + read_config();
> + if (name)
> + name_given = 1;
> + else {
> + if (pushremote_name) {
> + name = pushremote_name;
> + name_given = 1;
> + } else {
> + name = default_remote_name;
> + name_given = explicit_default_remote_name;
> + }
> + }
> + return remote_get_1(name, name_given);
> +}
Can we get rid of this duplication by having remote_get_1 take a
service-specific default argument? And then each service calls it like:
struct remote *remote_get(const char *name)
{
read_config();
return remote_get_1(name, NULL);
}
struct remote *pushremote_get(const char *name)
{
read_config();
return remote_get_1(name, pushremote_name);
}
and all of the name_given junk can stay in remote_get_1. And adding
"remote.default" would just be a matter of changing that NULL in
remote_get.
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html