1. 26 4月, 2013 1 次提交
    • J
      prune: introduce OPT_EXPIRY_DATE() and use it · 27ec394a
      Junio C Hamano 提交于
      Earlier we added support for --expire=all (or --expire=now) that
      considers all crufts, regardless of their age, as eligible for
      garbage collection by turning command argument parsers that use
      approxidate() to use parse_expiry_date(), but "git prune" used a
      built-in parse-options facility OPT_DATE() and did not benefit from
      the new function.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      27ec394a
  2. 21 8月, 2012 1 次提交
  3. 09 5月, 2012 1 次提交
  4. 28 4月, 2012 1 次提交
    • N
      Add column layout skeleton and git-column · 7e29b825
      Nguyễn Thái Ngọc Duy 提交于
      A column option string consists of many token separated by either
      a space or a  comma. A token belongs to one of three groups:
      
       - enabling: always, never and auto
       - layout mode: currently plain (which does not layout at all)
       - other future tuning flags
      
      git-column can be used to pipe output to from a command that wants
      column layout, but not to mess with its own output code. Simpler output
      code can be changed to use column layout code directly.
      
      Thanks-to: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7e29b825
  5. 29 2月, 2012 1 次提交
  6. 29 9月, 2011 1 次提交
  7. 28 9月, 2011 1 次提交
    • J
      parse-options: deprecate OPT_BOOLEAN · b04ba2bb
      Junio C Hamano 提交于
      It is natural to expect that an option defined with OPT_BOOLEAN() could be
      used in this way:
      
      	int option = -1; /* unspecified */
      
      	struct option options[] = {
      		OPT_BOOLEAN(0, "option", &option, "set option"),
                      OPT_END()
      	};
      	parse_options(ac, av, prefix, options, usage, 0);
      
              if (option < 0)
              	... do the default thing ...
      	else if (!option)
      		... --no-option was given ...
      	else
      		... --option was given ...
      
      to easily tell three cases apart:
      
       - There is no mention of the `--option` on the command line;
       - The variable is positively set with `--option`; or
       - The variable is explicitly negated with `--no-option`.
      
      Unfortunately, this is not the case. OPT_BOOLEAN() increments the variable
      every time `--option` is given, and resets it to zero when `--no-option`
      is given.
      
      As a first step to remedy this, introduce a true boolean OPT_BOOL(), and
      rename OPT_BOOLEAN() to OPT_COUNTUP(). To help transitioning, OPT_BOOLEAN
      and OPTION_BOOLEAN are defined as deprecated synonyms to OPT_COUNTUP and
      OPTION_COUNTUP respectively.
      
      This is what db7244bd (parse-options new features., 2007-11-07) from four
      years ago started by marking OPTION_BOOLEAN as "INCR would have been a
      better name".
      
      Some existing users do depend on the count-up semantics; for example,
      users of OPT__VERBOSE() could use it to raise the verbosity level with
      repeated use of `-v` on the command line, but they probably should be
      rewritten to use OPT__VERBOSITY() instead these days.  I suspect that some
      users of OPT__FORCE() may also use it to implement different level of
      forcibleness but I didn't check.
      
      On top of this patch, here are the remaining clean-up tasks that other
      people can help:
      
       - Look at each hit in "git grep -e OPT_BOOLEAN"; trace all uses of the
         value that is set to the underlying variable, and if it can proven that
         the variable is only used as a boolean, replace it with OPT_BOOL(). If
         the caller does depend on the count-up semantics, replace it with
         OPT_COUNTUP() instead.
      
       - Same for OPTION_BOOLEAN; replace it with OPTION_SET_INT and arrange to
         set 1 to the variable for a true boolean, and otherwise replace it with
         OPTION_COUNTUP.
      
       - Look at each hit in "git grep -e OPT__VERBOSE -e OPT__QUIET" and see if
         they can be replaced with OPT__VERBOSITY().
      
      I'll follow this message up with a separate patch as an example.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b04ba2bb
  8. 12 8月, 2011 1 次提交
  9. 23 6月, 2011 1 次提交
  10. 16 2月, 2011 1 次提交
  11. 08 12月, 2010 2 次提交
    • J
      parse-options: make resuming easier after PARSE_OPT_STOP_AT_NON_OPTION · 979240fe
      Jonathan Nieder 提交于
      Introduce a PARSE_OPT_NON_OPTION state, so parse_option_step()
      callers can easily distinguish between non-options and other
      reasons for option parsing termination (like "--").
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      979240fe
    • J
      parse-options: allow git commands to invent new option types · b0b3a8b6
      Jonathan Nieder 提交于
      parse-options provides a variety of option behaviors, including
      OPTION_CALLBACK, which should take care of just about any sane
      behavior.  All supported behaviors obey the following constraint:
      
       A --foo option can only accept (and base its behavior on)
       one argument, which would be the following command-line
       argument in the "unsticked" form.
      
      Alas, some existing git commands have options that do not obey that
      constraint.  For example, update-index --cacheinfo takes three
      arguments, and update-index --resolve takes all later parameters as
      arguments.
      
      Introduces an OPTION_LOWLEVEL_CALLBACK backdoor to parse-options so
      such option types can be supported without tempting inventors of other
      commands through mention in the public API.  Commands can set the
      callback field to a function accepting three arguments: the option
      parsing context, the option itself, and a flag indicating whether the
      the option was negated.  When the option is encountered, that function
      is called to take over from get_value().  The return value should be
      zero for success, -1 for usage errors.
      
      Thanks to Stephen Boyd for API guidance.
      Improved-by: NStephen Boyd <bebarino@gmail.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b0b3a8b6
  12. 07 12月, 2010 1 次提交
  13. 16 11月, 2010 4 次提交
  14. 25 8月, 2010 1 次提交
  15. 14 6月, 2010 1 次提交
  16. 01 6月, 2010 1 次提交
    • G
      enums: omit trailing comma for portability · 4b05548f
      Gary V. Vaughan 提交于
      Without this patch at least IBM VisualAge C 5.0 (I have 5.0.2) on AIX
      5.1 fails to compile git.
      
      enum style is inconsistent already, with some enums declared on one
      line, some over 3 lines with the enum values all on the middle line,
      sometimes with 1 enum value per line... and independently of that the
      trailing comma is sometimes present and other times absent, often
      mixing with/without trailing comma styles in a single file, and
      sometimes in consecutive enum declarations.
      
      Clearly, omitting the comma is the more portable style, and this patch
      changes all enum declarations to use the portable omitted dangling
      comma style consistently.
      Signed-off-by: NGary V. Vaughan <gary@thewrittenword.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4b05548f
  17. 07 3月, 2010 1 次提交
  18. 19 2月, 2010 1 次提交
    • M
      Add an optional argument for --color options · 73e9da01
      Mark Lodato 提交于
      Make git-branch, git-show-branch, git-grep, and all the diff-based
      programs accept an optional argument <when> for --color.  The argument
      is a colorbool: "always", "never", or "auto".  If no argument is given,
      "always" is used;  --no-color is an alias for --color=never.  This makes
      the command-line interface consistent with other GNU tools, such as `ls'
      and `grep', and with the git-config color options.  Note that, without
      an argument, --color and --no-color work exactly as before.
      
      To implement this, two internal changes were made:
      
      1. Allow the first argument of git_config_colorbool() to be NULL,
         in which case it returns -1 if the argument isn't "always", "never",
         or "auto".
      
      2. Add OPT_COLOR_FLAG(), OPT__COLOR(), and parse_opt_color_flag_cb()
         to the option parsing library.  The callback uses
         git_config_colorbool(), so color.h is now a dependency
         of parse-options.c.
      Signed-off-by: NMark Lodato <lodatom@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      73e9da01
  19. 12 1月, 2010 1 次提交
  20. 04 12月, 2009 1 次提交
  21. 31 7月, 2009 1 次提交
  22. 09 6月, 2009 1 次提交
  23. 07 6月, 2009 2 次提交
  24. 01 6月, 2009 1 次提交
  25. 25 5月, 2009 2 次提交
    • S
      parse-opts: add OPT_FILENAME and transition builtins · df217ed6
      Stephen Boyd 提交于
      Commit dbd0f5c7 (Files given on the command line are relative to $cwd,
      2008-08-06) introduced parse_options_fix_filename() as a minimal fix.
      OPT_FILENAME is intended to be a more robust fix for the same issue.
      OPT_FILENAME and its associated enum OPTION_FILENAME are used to
      represent filename options within the parse options API.
      
      This option is similar to OPTION_STRING. If --no is prefixed to the
      option the filename is unset. If no argument is given and the default
      value is set, the filename is set to the default value. The difference
      is that the filename is prefixed with the prefix passed to
      parse_options() (or parse_options_start()).
      
      Update git-apply, git-commit, git-fmt-merge-msg, and git-tag to use
      OPT_FILENAME with their filename options. Also, rename
      parse_options_fix_filename() to fix_filename() as it is no longer
      extern.
      Signed-off-by: NStephen Boyd <bebarino@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      df217ed6
    • S
      parse-opts: prepare for OPT_FILENAME · 37782920
      Stephen Boyd 提交于
      To give OPT_FILENAME the prefix, we pass the prefix to parse_options()
      which passes the prefix to parse_options_start() which sets the prefix
      member of parse_opts_ctx accordingly. If there isn't a prefix in the
      calling context, passing NULL will suffice.
      Signed-off-by: NStephen Boyd <bebarino@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      37782920
  26. 23 5月, 2009 1 次提交
    • S
      parse-options: add PARSE_OPT_LITERAL_ARGHELP for complicated argh's · 29f25d49
      Stephen Boyd 提交于
      Usually, the argh element in struct option points at a placeholder value
      (e.g. "val"), and is shown in the usage message as
      
          --option=<val>
      
      by enclosing the string inside of angle brackets.
      
      When the option is more complex (e.g. optional arguments separated by a
      comma), you would want to produce a usage message that looks like
      
          --option=<val1>[,<val2>]
      
      In such a case, the caller can pass a string to argh with placeholders
      already enclosed in necessary angle brackets (e.g.  "<val1>[,<val2>]")
      and set this flag.
      Signed-off-by: NStephen Boyd <bebarino@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      29f25d49
  27. 09 5月, 2009 3 次提交
  28. 23 4月, 2009 1 次提交
  29. 09 3月, 2009 2 次提交
  30. 29 1月, 2009 1 次提交
  31. 15 11月, 2008 1 次提交