Re: [PATCH RFC v2 14/25] ref-filter: add is_cat flag

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

 



Olga Telezhnaya <olyatelezhnaya@xxxxxxxxx> writes:

> diff --git a/ref-filter.c b/ref-filter.c
> index 34a54db168265..91290b62450b3 100644
> --- a/ref-filter.c
> +++ b/ref-filter.c
> @@ -101,6 +101,7 @@ static struct used_atom {
>  } *used_atom;
>  static int used_atom_cnt, need_tagged, need_symref;
>  struct expand_data *cat_file_info;
> +static int is_cat = 0;
>   ...
> @@ -739,6 +740,7 @@ int verify_ref_format(struct ref_format *format)
>  	const char *cp, *sp;
>  
>  	cat_file_info = format->cat_file_data;
> +	is_cat = format->is_cat;

Eek.  The global cat_file_info itself may already be bad enough, but
now we have another one?

Hopefully these are all cleaned up in later steps in the series?

>  	format->need_color_reset_at_eol = 0;
>  	for (cp = format->format; *cp && (sp = find_next(cp)); ) {
>  		const char *color, *ep = strchr(sp, ')');
> @@ -748,7 +750,7 @@ int verify_ref_format(struct ref_format *format)
>  			return error(_("malformed format string %s"), sp);
>  		/* sp points at "%(" and ep points at the closing ")" */
>  
> -		if (format->cat_file_data)
> +		if (is_cat)
>  			at = parse_ref_filter_atom(format, valid_cat_file_atom,
>  						   ARRAY_SIZE(valid_cat_file_atom), sp + 2, ep);
>  		else {
> @@ -1438,7 +1440,7 @@ int populate_value(struct ref_array_item *ref)
>  			ref->symref = "";
>  	}
>  
> -	if (cat_file_info && check_and_fill_for_cat(ref))
> +	if (is_cat && check_and_fill_for_cat(ref))
>  		return -1;
>  
>  	/* Fill in specials first */
> diff --git a/ref-filter.h b/ref-filter.h
> index 5c6e019998716..69271e8c39f40 100644
> --- a/ref-filter.h
> +++ b/ref-filter.h
> @@ -125,6 +125,7 @@ struct ref_format {
>  	 * hopefully would be reduced later.
>  	 */
>  	struct expand_data *cat_file_data;
> +	int is_cat;
>  };
>  
>  #define REF_FORMAT_INIT { NULL, 0, -1 }
>
> --
> https://github.com/git/git/pull/452



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

  Powered by Linux