Re: [PATCH 02/15] [GSOC] ref-filter: add %(raw) atom

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

 



On Thu, Jul 01 2021, ZheNing Hu via GitGitGadget wrote:

> @@ -1362,17 +1398,29 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct exp
>  	const char *subpos = NULL, *bodypos = NULL, *sigpos = NULL;
>  	size_t sublen = 0, bodylen = 0, nonsiglen = 0, siglen = 0;
>  	void *buf = data->content;
> +	unsigned long buf_size = data->size;

Let's declare this.

>  	for (i = 0; i < used_atom_cnt; i++) {
>  		struct used_atom *atom = &used_atom[i];
>  		const char *name = atom->name;
>  		struct atom_value *v = &val[i];
> +		enum atom_type atom_type = atom->atom_type;
>  
>  		if (!!deref != (*name == '*'))
>  			continue;
>  		if (deref)
>  			name++;
>  
> +		if (atom_type == ATOM_RAW) {

Here, where it's going to be used.

> +static int memcasecmp(const void *vs1, const void *vs2, size_t n)
> +{
> +	const char *s1 = vs1, *s2 = vs2;
> +	const char *end = s1 + n;
> +
> +	for (; s1 < end; s1++, s2++) {
> +		int diff = tolower(*s1) - tolower(*s2);
> +		if (diff)
> +			return diff;
> +	}
> +	return 0;
> +}

I thought we had such a thing already, but clearly not...

> diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
> index 9e0214076b4..18554f62d94 100755
> --- a/t/t6300-for-each-ref.sh
> +++ b/t/t6300-for-each-ref.sh
> @@ -130,6 +130,8 @@ test_atom head parent:short=10 ''
>  test_atom head numparent 0
>  test_atom head object ''
>  test_atom head type ''
> +test_atom head raw "$(git cat-file commit refs/heads/main)
> +"

Extra stay line here, is the \n intentional?



[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