Re: [PATCH 07/25] list-files: add tag to each entry, filter duplicate tags

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

 



On Mon, Apr 6, 2015 at 9:52 AM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> All entries have a two-letter tag. If all entries have the same tags,
> tags are not displayed.
>
> The outcome before and after this patch is the same. But it will be
> useful in future when there are more than one type of entry.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
> diff --git a/builtin/list-files.c b/builtin/list-files.c
> index 51ff19d..ec9ca17 100644
> --- a/builtin/list-files.c
> +++ b/builtin/list-files.c
> @@ -52,10 +56,61 @@ static void populate_cached_entries(struct item_list *result,
> +static void cleanup_tags(struct item_list *result)
> +{
> +       int i, same_1 = 1, same_2 = 1;
> +
> +       if (!show_tag) {
> +               result->tag_pos = 0;
> +               result->tag_len = 0;
> +               return;
> +       }
> [...]
> +}
> +
> +/* this is similar to quote_path_relative() except it does not clear sb */

This comment is a bit confusing since it talks about 'sb', which is a
local variable, rather than the intended 'out'. Perhaps rephrase:

    /* similar to quote_path_relative() but does not clear 'out' */

> +static void quote_item(struct strbuf *out, const struct item *item)
> +{
> +       static struct strbuf sb = STRBUF_INIT;
> +       const char *rel;
> +
> +       strbuf_reset(&sb);
> +       rel = relative_path(item->path, prefix, &sb);
> +       quote_c_style(rel, out, NULL, 0);
> +}
> +
>  static void display(const struct item_list *result)
>  {
>         struct strbuf quoted = STRBUF_INIT;
--
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]