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

Re: [PATCHv4 1/4] Refactor for_each_ref variants to use for_each_ref_in and avoid magic numbers

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 2, 2011, 23:29 UTC
Message-ID
<7v4o47dd8j.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110602205747.GA2022@leaf>
Josh Triplett <josh@joshtriplett.org> writes:
>> Shouldn't you be passing prefix and trim the same way as we have always
>> done, but just fixing the strncmp() at the beginning of do_one_ref()?
>
> I still think prefixcmp makes the most sense; if you pass a given base,

Using prefixcmp() instead of strncmp() there is what I meant by "fixing the strncmp() at the beginning of do_one_ref()", so we are in agreement on that point. What I found questionable was the removal of the trim value. IOW, I would have expected the patch to be something like:

	if (prefixcmp(base, entry->name))
        	return 0; /* outside of our area -- ignore */
	... some other logic ...
        /* feed the callback, stripping the prefix */
        return fn(entry->name + trim, entry->sha1, entry->flag, cb_data);
Previous: Josh TriplettNext: Jakub Narebski
Message 19 of 20 in “[PATCHv4 1/4] Refactor for_each_ref variants to use for_each_ref_in and avoid magic numbers”
  1. Jamey SharpJun 1, 2011
  2. 2/4 Add infrastructure for ref namespacesJamey Sharp, Jun 1, 2011
  3. Junio C HamanoJun 2, 2011
  4. Josh TriplettJun 2, 2011
  5. Junio C HamanoJun 3, 2011
  6. Josh TriplettJun 3, 2011
  7. Jakub NarebskiJun 3, 2011
  8. Josh TriplettJun 3, 2011
  9. Jakub NarebskiJun 8, 2011
  10. Josh TriplettJun 9, 2011
  11. Jakub NarebskiJun 9, 2011
  12. 3/4 Support ref namespaces for remote repositories via upload-pack and receive-packJamey Sharp, Jun 1, 2011
  13. Junio C HamanoJun 2, 2011
  14. josh@joshtriplett.orgJun 3, 2011
  15. Junio C HamanoJun 3, 2011
  16. 4/4 Add documentation for ref namespacesJamey Sharp, Jun 1, 2011
  17. Junio C HamanoJun 2, 2011
  18. Josh TriplettJun 2, 2011
  19. Junio C HamanoJun 2, 2011
  20. Jakub NarebskiJun 3, 2011

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.