Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7d0c1f4556
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ed88148674
Choose a head ref
  • 14 commits
  • 10 files changed
  • 1 contributor

Commits on Jan 18, 2019

  1. parse-options.h: remove extern on function prototypes

    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 18, 2019
    Configuration menu
    Copy the full SHA
    1987b0b View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2019

  1. parse-options: add one-shot mode

    This is to help reimplement diff_opt_parse() using parse_options().
    The behavior of parse_options() is changed to be the same as the
    other:
    
    - no argv0 in argv[], everything can be processed
    - argv[] must not be updated, it's the caller's job to do that
    - return the number of arguments processed
    - leave all unknown options / non-options alone (this one can already
      be achieved with PARSE_OPT_KEEP_UNKNOWN and
      PARSE_OPT_STOP_AT_NON_OPTION)
    
    This mode is NOT supposed to stay here for long. It's to help
    converting diff/rev option parsing. Once that work is over and we can
    just use parse_options() throughout the code base, this will be
    deleted.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    202fbb3 View commit details
    Browse the repository at this point in the history
  2. parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN

    parse-options can unambiguously find an abbreviation only if it sees
    all available options. This is usually the case when you use
    parse_options(). But there are other callers like blame or shortlog
    which uses parse_options_start() in combination with a custom option
    parser, like rev-list. parse-options cannot see all options in this
    case and will get abbrev detection wrong. Disable it.
    
    t7800 needs update because --symlink no longer expands to --symlinks
    and will be passed down to git-diff, which will not recognize it. I
    still think this is the correct thing to do. But if --symlink has been
    actually used in the wild, we would just add an option alias for it.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    baa4adc View commit details
    Browse the repository at this point in the history
  3. parse-options: add OPT_BITOP()

    This is needed for diff_opt_parse() where we do
    
       value = (value & ~mask) | some_more;
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    f62470c View commit details
    Browse the repository at this point in the history
  4. parse-options: stop abusing 'callback' for lowlevel callbacks

    Lowlevel callbacks have different function signatures. Add a new field
    in 'struct option' with the right type for lowlevel callbacks.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    bf3ff33 View commit details
    Browse the repository at this point in the history
  5. parse-options: avoid magic return codes

    Give names to these magic negative numbers. Make parse_opt_ll_cb
    return an enum to make clear it can actually control parse_options()
    with different return values (parse_opt_cb can too, but nobody needs
    it).
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    f41179f View commit details
    Browse the repository at this point in the history
  6. parse-options: allow ll_callback with OPTION_CALLBACK

    OPTION_CALLBACK is much simpler/safer to use, but parse_opt_cb does
    not allow access to parse_opt_ctx_t, which sometimes is useful
    (e.g. to obtain the prefix).
    
    Extending parse_opt_cb to take parse_opt_cb could result in a lot of
    changes. Instead let's just allow ll_callback to be used with
    OPTION_CALLBACK. The user will have to be careful, not to change
    anything in ctx, or return wrong result code. But that's the price for
    ll_callback.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    3ebbe28 View commit details
    Browse the repository at this point in the history
  7. diff.h: keep forward struct declarations sorted

    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    4a1b13a View commit details
    Browse the repository at this point in the history
  8. diff.h: avoid bit fields in struct diff_flags

    Bitfield addresses cannot be passed around in a pointer. This makes it
    hard to use parse-options to set/unset them. Turn this struct to
    normal integers. This of course increases the size of this struct
    multiple times, but since we only have a handful of diff_options
    variables around, memory consumption is not at all a concern.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    2b393ef View commit details
    Browse the repository at this point in the history
  9. diff.c: prepare to use parse_options() for parsing

    This is a preparation step to start using parse_options() to parse
    diff/revision options instead of what we have now. There are a couple
    of good things from using parse_options():
    
    - better help usage
    - easier to add new options
    - better completion support
    - help usage generation
    - better integration with main command option parser. We can just
      concat the main command's option array and diffopt's together and
      parse all in one go.
    - detect colidding options (e.g. --reverse is used by revision code,
      so diff code can't use it as long name for -R)
    - consistent syntax, e.g. option that takes mandatory argument will
      now accept both "--option=value" and "--option value".
    
    The plan is migrate all diff/rev options to parse_options(). Then we
    could get rid of diff_opt_parse() and expose parseopts[] directly to
    the caller.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    4a28847 View commit details
    Browse the repository at this point in the history
  10. diff.c: convert -u|-p|--patch

    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    cc013c2 View commit details
    Browse the repository at this point in the history
  11. diff.c: convert -U|--unified

    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    d473e2e View commit details
    Browse the repository at this point in the history
  12. diff.c: convert -W|--[no-]function-context

    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    7fd9a1b View commit details
    Browse the repository at this point in the history
  13. diff.c: convert --raw

    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jan 28, 2019
    Configuration menu
    Copy the full SHA
    ed88148 View commit details
    Browse the repository at this point in the history
Loading