Re: [PATCH 07/45] parse_pathspec: add PATHSPEC_PREFER_{CWD,FULL}

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

 



On Sun, Jun 9, 2013 at 2:25 AM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> diff --git a/pathspec.c b/pathspec.c
> index 89bdc7f..9e68321 100644
> --- a/pathspec.c
> +++ b/pathspec.c
> @@ -271,10 +271,20 @@ void parse_pathspec(struct pathspec *pathspec,
>         if (!entry && !prefix)
>                 return;
>
> +       if ((flags & PATHSPEC_PREFER_CWD) &&
> +           (flags & PATHSPEC_PREFER_FULL))
> +               die("BUG: PATHSPEC_PREFER_CWD and PATHSPEC_PREFER_FULL are incompatible");
> +
>         /* No arguments with prefix -> prefix pathspec */
>         if (!entry) {
>                 static const char *raw[2];
>
> +               if (flags & PATHSPEC_PREFER_FULL)
> +                       return;
> +
> +               if (!(flags & PATHSPEC_PREFER_CWD))
> +                       die("BUG: parse_pathspec cannot take no arguments in this case");

"in this case" is a bit nebulous. Perhaps:

    die("BUG: PATHSPEC_PREFER_CWD requires arguments");

>                 pathspec->items = item = xmalloc(sizeof(*item));
>                 memset(item, 0, sizeof(*item));
>                 item->match = prefix;
> @@ -340,7 +350,8 @@ const char **get_pathspec(const char *prefix, const char **pathspec)
>         struct pathspec ps;
>         parse_pathspec(&ps,
>                        PATHSPEC_ALL_MAGIC & ~PATHSPEC_FROMTOP,
> -                      0, prefix, pathspec);
> +                      PATHSPEC_PREFER_CWD,
> +                      prefix, pathspec);
>         return ps.raw;
>  }
--
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]