git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/WIP v3 2/4] for-each-ref: introduce new structures for better organisation

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
May 28, 2015, 20:26 UTC
Message-ID
<vpqegm0o3dx.fsf@anie.imag.fr>
In-Reply-To
<1432835025-13291-2-git-send-email-karthik.188@gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
> Rename 'refinfo' to 'ref_array_item' and intoduce 'ref_filter_cbdata'

The fact that you need to use "and" to describe your changes is a hint that you can split better.

The patch looks much better, but I think you still need to split more to make it easier to review.

> - * of properties that we need to extract out of objects.  refinfo
> + * of properties that we need to extract out of objects. ref_array_item

Not very important, but two spaces after a period is what one is supposed to do in English. Not everybody follow the rule, but it seems backward to change the code to break it.

Show 5 quoted lines
>  	if (flag & REF_BAD_NAME) {
> -		  warning("ignoring ref with broken name %s", refname);
> -		  return 0;
> +		warning("ignoring ref with broken name %s", refname);
> +		return 0;
Whitespace fix mixed with actual code.
Show 12 quoted lines
> -static int cmp_ref_sort(struct ref_sort *s, struct refinfo *a, struct refinfo *b)
> +/* Free all memory allocated for ref_filter_cbdata */
> +void ref_filter_clear_data(struct ref_filter_cbdata *ref_cbdata)
> +{
> +	int i;
> +
> +	for (i = 0; i < ref_cbdata->array.nr; i++)
> +		free(ref_cbdata->array.items[i]);
> +	free(ref_cbdata->array.items);
> +	ref_cbdata->array.items = NULL;
> +	ref_cbdata->array.nr = ref_cbdata->array.alloc = 0;
> +}

And this one is a real behavior change, which would be much better documented in its own patch with a proper commit message (we had a memory leak before, we didn't care because it happened right before exiting, but we can't accept that in a clean library).

Reviewing is not just about having a look and seeing if there's something stupid. Reviewers are actually taking a lot of time to see if the patch does not introduce new bugs, or looking for better ways to do the same thing. Be nice with them!

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Karthik NayakNext: Karthik Nayak
Message 6 of 15 in “for-each-ref: re-structure code for moving to 'ref-filter'”
  1. 1/4 for-each-ref: re-structure code for moving to 'ref-filter'Karthik Nayak, May 28, 2015
  2. 1/4 for-each-ref: extract helper functions out of grab_single_ref()Karthik Nayak, May 28, 2015
  3. Matthieu MoyMay 28, 2015
  4. Karthik NayakMay 28, 2015
  5. 2/4 for-each-ref: introduce new structures for better organisationKarthik Nayak, May 28, 2015
  6. Matthieu MoyMay 28, 2015
  7. Karthik NayakMay 28, 2015
  8. Matthieu MoyMay 28, 2015
  9. Karthik NayakMay 28, 2015
  10. Junio C HamanoMay 28, 2015
  11. Junio C HamanoMay 28, 2015
  12. 3/4 for-each-ref: rename some functions and make them publicKarthik Nayak, May 28, 2015
  13. 4/4 ref-filter: move code from 'for-each-ref'Karthik Nayak, May 28, 2015
  14. Matthieu MoyMay 28, 2015
  15. Karthik NayakMay 28, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.