Re: [PATCH 12/13] remote.c: refactor get_remote_ref_states()
From: Jeff King <hidden>
Date: 2016-06-15 22:46:16
On Mon, Feb 23, 2009 at 02:55:32AM -0500, Jay Soffian wrote:
I see your hmph and raise you a hmph. :-) Well, I _had_ tried as you suggested first, and thought it yuckier. It would actually be more like:
OK. My comment was along the lines of "why didn't you think of doing it this way first?" but apparently you did. ;)
I'm not sure why passing a flag saying what you want is obfuscating.
It doesn't have to be. But from your description and my cursory look over the code, it seemed like get_remote_ref_states was really conflating several unrelated things. So breaking it apart would make sense for the same reason we have "strlen" and "strchr" as separate functions and not "string_ops(s, WANT_STRLEN)": the function is our basic unit of reusable work. But from your description:
caller1() {
setup_for_get();
get_thing_one();
}I didn't realize the commonality was actual setup; I thought it was "do a list of 5 things, but the first 2 are common, and then callers may want to some mix of the other 3". So I think your original patch is fine. -Peff