Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Jun 21, 2009
  1. @torvalds

    Fix various sparse warnings in the git source code

    torvalds authored committed
    There are a few remaining ones, but this fixes the trivial ones. It boils
    down to two main issues that sparse complains about:
    
     - warning: Using plain integer as NULL pointer
    
       Sparse doesn't like you using '0' instead of 'NULL'. For various good
       reasons, not the least of which is just the visual confusion. A NULL
       pointer is not an integer, and that whole "0 works as NULL" is a
       historical accident and not very pretty.
    
       A few of these remain: zlib is a total mess, and Z_NULL is just a 0.
       I didn't touch those.
    
     - warning: symbol 'xyz' was not declared. Should it be static?
    
       Sparse wants to see declarations for any functions you export. A lack
       of a declaration tends to mean that you should either add one, or you
       should mark the function 'static' to show that it's in file scope.
    
       A few of these remain: I only did the ones that should obviously just
       be made static.
    
    That 'wt_status_submodule_summary' one is debatable. It has a few related
    flags (like 'wt_status_use_color') which _are_ declared, and are used by
    builtin-commit.c. So maybe we'd like to export it at some point, but it's
    not declared now, and not used outside of that file, so 'static' it is in
    this patch.
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 18, 2009
  1. Merge branch 'sb/parse-options-integer'

    authored
    * sb/parse-options-integer:
      parse-options: simplify usage argh handling
      parse-options: make OPT_INTEGER's argh explicit
Commits on Jun 10, 2009
  1. @MadCoder

    parse-options: add parse_options_check to validate option specs.

    MadCoder authored committed
    It only searches for now for the dreaded LASTARG_DEFAULT | OPTARG
    combination, but can be extended to check for any other forbidden
    combination.
    
    Options are checked each time we call parse_options_start.
    
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 6, 2009
  1. @bebarino

    parse-options: simplify usage argh handling

    bebarino authored committed
    Simplify the argh printing by simply calling usage_argh() if the option
    can take an argument. Update macros defined in parse-options.h to set
    the PARSE_OPT_NOARG flag.
    
    The only other user of custom non-argument taking options is git-apply
    (in this case OPTION_BOOLEAN for deprecated options). Update it to set
    the PARSE_OPT_NOARG flag.
    
    Thanks to Ren辿 Scharfe for the suggestion and starter patch.
    
    Signed-off-by: Stephen Boyd <bebarino@gmail.com>
    Reviewd-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @bebarino

    parse-options: make OPT_INTEGER's argh explicit

    bebarino authored committed
    OPTION_INTEGER hardcodes its argh member to be "n", but the decision is
    hidden deep in usage_with_options_internal(). Make "n" the default argh
    for the OPT_INTEGER macro while leaving it undecided for the OPTION_INTEGER
    enum.
    
    This makes it less surprising to users that argh is "n" when using the
    OPT_INTEGER macro.
    
    Signed-off-by: Stephen Boyd <bebarino@gmail.com>
    Reviewed-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 25, 2009
  1. @bebarino

    parse-opts: add OPT_FILENAME and transition builtins

    bebarino authored committed
    Commit dbd0f5c (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: Stephen Boyd <bebarino@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @bebarino

    parse-opts: prepare for OPT_FILENAME

    bebarino authored committed
    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: Stephen Boyd <bebarino@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. Merge branch 'sb/show-branch-parse-options' into sb/opt-filename

    authored
    * sb/show-branch-parse-options:
      show-branch: migrate to parse-options API
      parse-options: add PARSE_OPT_LITERAL_ARGHELP for complicated argh's
    
    Conflicts:
    	parse-options.h
Commits on May 23, 2009
  1. @bebarino

    parse-options: add PARSE_OPT_LITERAL_ARGHELP for complicated argh's

    bebarino authored committed
    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: Stephen Boyd <bebarino@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 9, 2009
  1. parseopt: add PARSE_OPT_NODASH

    René Scharfe authored committed
    Add support for options that don't start with a dash.  Initially, they
    don't accept arguments and can only be short options, i.e. consist of a
    single character.
    
    Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. parseopt: add OPT_NUMBER_CALLBACK

    René Scharfe authored committed
    Add a way to recognize numerical options.  The number is passed to
    a callback function as a string.
    
    Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. parseopt: add OPT_NEGBIT

    René Scharfe authored committed
    Add OPTION_NEGBIT and OPT_NEGBIT, mirroring OPTION_BIT and OPT_BIT.
    OPT_NEGBIT can be used together with OPT_BIT to define two options
    that cancel each other out.
    
    Note: this patch removes the reminder from the test script because
    it adds a test for --no-or4 and there already was one for --or4.
    
    Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 9, 2009
  1. parseopt: prevent KEEP_UNKNOWN and STOP_AT_NON_OPTION from being used…

    René Scharfe authored committed
    … together
    
    As suggested by Junio, disallow the flags PARSE_OPT_KEEP_UNKNOWN and
    PARSE_OPT_STOP_AT_NON_OPTION to be turned on at the same time, as a
    value of an unknown option could be mistakenly classified as a
    non-option, stopping the parser early.  E.g.:
    
    	git cmd --known --unknown value arg0 arg1
    
    The parser should have stopped at "arg0", but it already stops at
    "value".
    
    This patch makes parse_options() die if the two flags are used in
    combination.
    
    Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 8, 2009
  1. parseopt: make usage optional

    René Scharfe authored committed
    Allow usagestr to be NULL and don't display any help screen in
    this case.  This is useful to implement incremental parsers.
    
    Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. parseopt: add PARSE_OPT_NO_INTERNAL_HELP

    René Scharfe authored committed
    Add a parseopt flag, PARSE_OPT_NO_INTERNAL_HELP, that turns off internal
    handling of -h, --help and --help-all.  This allows the implementation
    of custom help option handlers or incremental parsers.
    
    Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. parseopt: add PARSE_OPT_KEEP_UNKNOWN

    René Scharfe authored committed
    Add a parseopt flag, PARSE_OPT_KEEP_UNKNOWN, that can be used to keep
    unknown options in argv, similar to the existing KEEP flags.
    
    Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 28, 2009
  1. Make opt_parse_with_commit() non-static

    Jake Goulding authored committed
    Moving opt_parse_with_commit() from branch to a common location, in
    preparation for using it in tag. Rename it to match naming convention
    of other option parsing functions.
    
    Signed-off-by: Jake Goulding <goulding@vivisimo.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 15, 2008
  1. @tuncer

    Teach/Fix pull/fetch -q/-v options

    tuncer authored committed
    Implement git-pull --quiet and git-pull --verbose by
    adding the options to git-pull and fixing verbosity
    handling in git-fetch.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 6, 2008
  1. Sync with 1.5.6.5

    authored
  2. Files given on the command line are relative to $cwd

    authored
    When running "git commit -F file" and "git tag -F file" from a
    subdirectory, we should take it as relative to the directory we started
    from, not relative to the top-level directory.
    
    This adds a helper function "parse_options_fix_filename()" to make it more
    convenient to fix this class of issues.  Ideally, parse_options() should
    support a new type of option, "OPT_FILENAME", to do this uniformly, but
    this patch is meant to go to 'maint' to fix it minimally.
    
    One thing to note is that value for "commit template file" that comes from
    the command line is taken as relative to $cwd just like other parameters,
    but when it comes from the configuration varilable 'commit.template', it
    is taken as relative to the working tree root as before.  I think this
    difference actually is sensible (not that I particularly think
    commit.template itself is sensible).
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 22, 2008
  1. parse-options: fix segmentation fault when a required value is missing

    Olivier Marin authored committed
    p->argc represent the number of arguments that have not been parsed yet,
    _including_ the one we are currently parsing. If it is not greater than
    one then there is no more argument.
    
    Signed-off-by: Olivier Marin <dkr@freesurf.fr>
    Acked-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 16, 2008
  1. parse-options.c: make check_typos() static

    Nanako Shiraishi authored committed
    This function is not used by any other file.
    
    Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. Merge branch 'mv/merge-in-c'

    authored
    * mv/merge-in-c:
      reduce_heads(): protect from duplicate input
      reduce_heads(): thinkofix
      Add a new test for git-merge-resolve
      t6021: add a new test for git-merge-resolve
      Teach merge.log to "git-merge" again
      Build in merge
      Fix t7601-merge-pull-config.sh on AIX
      git-commit-tree: make it usable from other builtins
      Add new test case to ensure git-merge prepends the custom merge message
      Add new test case to ensure git-merge reduces octopus parents when possible
      Introduce reduce_heads()
      Introduce get_merge_bases_many()
      Add new test to ensure git-merge handles more than 25 refs.
      Introduce get_octopus_merge_bases() in commit.c
      git-fmt-merge-msg: make it usable from other builtins
      Move read_cache_unmerged() to read-cache.c
      Add new test to ensure git-merge handles pull.twohead and pull.octopus
      Move parse-options's skip_prefix() to git-compat-util.h
      Move commit_list_count() to commit.c
      Move split_cmdline() to alias.c
    
    Conflicts:
    	Makefile
    	parse-options.c
Commits on Jul 9, 2008
  1. @MadCoder

    parse-options: add PARSE_OPT_LASTARG_DEFAULT flag

    MadCoder authored committed
    If you set this for a given option, and the optoin appears without an
    argument on the command line, then the `defval' is used as its argument.
    
    Note that this flag is meaningless in presence of OPTARG or NOARG flags.
    (in the current implementation it will be ignored, but don't rely on it).
    
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 1, 2008
  1. Move parse-options's skip_prefix() to git-compat-util.h

    Miklos Vajna authored committed
    builtin-remote.c and parse-options.c both have a skip_prefix() function,
    for the same purpose. Move parse-options's one to git-compat-util.h and
    let builtin-remote use it as well.
    
    Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 30, 2008
  1. @MadCoder

    parse-opt: add PARSE_OPT_KEEP_ARGV0 parser option.

    MadCoder authored committed
    This way, argv[0] isn't clobbered when parse-options filters argv[].
    
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @MadCoder

    parse-opt: fake short strings for callers to believe in.

    MadCoder authored committed
    If we begin to parse -abc and that the parser knew about -a and -b, it
    will fake a -c switch for the caller to deal with.
    
    Of course in the case of -acb (supposing -c is not taking an argument) the
    caller will have to be especially clever to do the same thing. We could
    think about exposing an API to do so if it's really needed, but oh well...
    
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @MadCoder

    parse-opt: do not print errors on unknown options, return -2 intead.

    MadCoder authored committed
    This way we can catch "unknown" options more easily.
    
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @MadCoder

    parse-opt: create parse_options_step.

    MadCoder authored committed
    For now it's unable to stop at unknown options, this commit merely
    reorganize some code around.
    
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. @MadCoder

    parse-opt: Export a non NORETURN usage dumper.

    MadCoder authored committed
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. @MadCoder

    parse-opt: have parse_options_{start,end}.

    MadCoder authored committed
    Make the struct optparse_t public under the better name parse_opt_ctx_t.
    
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 23, 2008
  1. Merge branch 'maint'

    authored
    * maint:
      Extend parse-options test suite
      api-parse-options.txt: Introduce documentation for parse options API
      parse-options.c: fix documentation syntax of optional arguments
      api-builtin.txt: update and fix typo
  2. parse-options.c: fix documentation syntax of optional arguments

    Michele Ballabio authored committed
    When an argument for an option is optional, short options don't need a
    space between the option and the argument, and long options need a "=".
    Otherwise, arguments are misinterpreted.
    
    Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 14, 2008
  1. @peff

    avoid whitespace on empty line in automatic usage message

    peff authored committed
    When outputting a usage message with a blank line in the
    header, we would output a line with four spaces. Make this
    truly a blank line.
    
    This helps us remove trailing whitespace from a test vector.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 10, 2008
  1. Merge branch 'maint-1.5.4' into maint

    authored
    * maint-1.5.4:
      core-tutorial.txt: Fix showing the current behaviour.
      git-archive: ignore prefix when checking file attribute
      Fix documentation syntax of optional arguments in short options.
Something went wrong with that request. Please try again.