Re: [PATCH v5 2/2] submodule: pass on http.extraheader config settings

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

 



Johannes Schindelin <johannes.schindelin@xxxxxx> writes:

> -     if (starts_with(var, "credential."))
> +     if (starts_with(var, "credential.") ||
> +                     (starts_with(var, "http.") &&
> +                      ends_with(var, ".extraheader")))

I know you are fond of indenting with HT without aligning things,
but this is going too far in the quest of making the code
unreadable.

        if (starts_with(var, "credential.") ||
            (starts_with(var, "http.") && ends_with(var, ".extraheader")))

would make iteasier to see what are the top-level items (there are two)
and how they are related (just one of them needs to be satisfied).

Assuming that we will discover more variables that can be safely
passed, I'd rather see the above written like this, though:

        if (starts_with(var, "credential."))
                return 1;
        if (starts_with(var, "http.") && ends_with(var, ".extraheader"))
                return 1;

        return 0;

Or even something along this line:

        struct whitelist {
                const char *prefix;
                const char *suffix;
        } whitelist[] = {
                { "credential.", NULL },
                { "http.", ".extraheader" },
        };

        for (i = 0; i < ARRAY_SIZE(whitelist); i++) {
                struct whitelist *w = &whitelist[i];
                if ((!w->prefix || starts_with(var, w->prefix)) &&
                    (!w->suffix || ends_with(var, w->suffix)))
                        return 1;
        }
        return 0;

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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