Re: [PATCH v2 21/25] fetch: define shallow boundary with --shallow-exclude

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

 



On Thu, Feb 4, 2016 at 4:03 AM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
> diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
> @@ -109,6 +109,16 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
> +               if (skip_prefix(arg, "--shallow-exclude=", &value)) {
> +                       static struct string_list *deepen_not;
> +                       if (!deepen_not) {
> +                               deepen_not = xmalloc(sizeof(*deepen_not));
> +                               string_list_init(deepen_not, 1);
> +                               args.deepen_not = deepen_not;
> +                       }
> +                       string_list_append(deepen_not, value);
> +                       continue;
> +               }

Hmm, can't this be simplified to:

    if (skip_prefix(arg, "--shallow-exclude=", &value)) {
        if (!args.deepen_not) {
            args.deepen_not = xmalloc(sizeof(*args.deepen_not));
            string_list_init(args.deepen_not, 1);
        }
        string_list_append(args.deepen_not, value);
        continue;
    }

Or, perhaps even better, declare it as plain 'struct string_list
deepen_not' in struct fetch_pack_args, rather than as a pointer, and
then in cmd_fetch_pack():

    memset(&args, 0, sizeof(args));
    args.uploadpack = "git-upload-pack";
    string_list_init(&args.deepen_not, 1);

    ...

    if (skip_prefix(arg, "--shallow-exclude=", &value)) {
        string_list_append(args.deepen_not, value);
        continue;
    }
--
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]