Re: diff.defaultOptions implementation design [was diff.primer]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 16, 2009 at 11:24:33PM -0800, Keith Cascio wrote:

> I like the idea of using parse-options to handle diff options and I
> too would like all switches negatable.  I will come back to the other
> ideas you mention if necessary.  You laid it all out nicely.

If you are interested in parse-optification of diff options, search the
archive for messages from Pierre Habouzit on the topic in the last 6
months or so. It was discussed at the GitTogether, and he had some
preliminary patches.

> diff_setup().  But diff_setup() must still ascertain at least one
> runtime fact: whether or not we are running one of the commands that
> respects default options {diff, log, show}.  Is there an elegant way
> to ascertain that fact from inside diff_setup()?  How do you
> recommend?  (BTW I believe my design achieves this elegantly).

You can impact the argument parsing by touching the diffopt struct
before doing the parsing. I.e., something like:

  /* we generally get diff options from a rev_info structure */
  struct rev_info rev;
  /* initialize the structures */
  init_revisions(&rev, prefix);
  /* now set any preferences specific to this command */
  DIFF_OPT_SET(&rev.diffopt, ALLOW_DEFAULT_CONFIG);
  /* and then actually parse */
  setup_revisions(argc, argv, rev, "HEAD");

See for example how cmd_whatchanged does it in builtin-log.c. Any
porcelains which wanted this feature would opt in to it.

-Peff
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux