Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:22

Josh Triplett [off-list ref] writes:
quoted
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);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help