On Fri, May 10, 2013 at 11:10 AM, Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> wrote: > From: Junio C Hamano <gitster@xxxxxxxxx> > > The diff_opt infrastructure sets flags based on defaults and command > line options. Currently, it is impossible to detect whether a flag has > been set as a default or on explicit request. > > Amend the structure so that this detection is possible: > > * There is an extra "opt->touched_flags" that keeps track of all > the fields that have been touched by DIFF_OPT_SET and > DIFF_OPT_CLR; > > * You may continue setting the default values to the flags, like > commands in the "log" family do in cmd_log_init_defaults(), but > after you finished setting the defaults, you clear the > touched_flags field; > > * And then you let the usual callchain call diff_opt_parse(), > allowing the opt->flags be set or unset, while keeping track of > which bits the user touched; > > * There is an optional callback "opt->set_default" that is called > at the very beginning to lets you inspect touched_flags and s/lets/let/ > update opt->flags appropriately, before the remainder of the > diffcore machinery is set up, taking the opt->flags value into > account. > > Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html