Re: [PATCHv3 2/7] diff_opt: track whether flags have been set explicitly
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 10, 2013, 15:31 UTC
- Message-ID
- <CAPig+cSAtXfeBYkw8Ob4i_ozETVwndONcQxH42ryU0ihKPTDjw@mail.gmail.com>
- In-Reply-To
- <88fb8906050411d0fe8b56cea160a4bfa1abb699.1368197380.git.git@drmicha.warpmail.net>
On Fri, May 10, 2013 at 11:10 AM, Michael J Gruber <git@drmicha.warpmail.net> wrote:
Show 23 quoted lines
> From: Junio C Hamano <gitster@pobox.com> > > 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/
Show 5 quoted lines
> 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@drmicha.warpmail.net>