1. 13 Aug, 2018 6 commits
    • Johannes Schindelin's avatar
      range-diff: do not show "function names" in hunk headers · 4eba1fe6
      Johannes Schindelin authored
      We are comparing complete, formatted commit messages with patches. There
      are no function names here, so stop looking for them.
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      4eba1fe6
    • Johannes Schindelin's avatar
      range-diff: adjust the output of the commit pairs · eb0be38c
      Johannes Schindelin authored
      This not only uses "dashed stand-ins" for "pairs" where one side is
      missing (i.e. unmatched commits that are present only in one of the two
      commit ranges), but also adds onelines for the reader's pleasure.
      
      This change brings `git range-diff` yet another step closer to
      feature parity with tbdiff: it now shows the oneline, too, and indicates
      with `=` when the commits have identical diffs.
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      eb0be38c
    • Johannes Schindelin's avatar
      range-diff: right-trim commit messages · a142f978
      Johannes Schindelin authored
      When comparing commit messages, we need to keep in mind that they are
      indented by four spaces. That is, empty lines are no longer empty, but
      have "trailing whitespace". When displaying them in color, that results
      in those nagging red lines.
      
      Let's just right-trim the lines in the commit message, it's not like
      trailing white-space in the commit messages are important enough to care
      about in `git range-diff`.
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      a142f978
    • Johannes Schindelin's avatar
      range-diff: also show the diff between patches · c8c5e43a
      Johannes Schindelin authored
      Just like tbdiff, we now show the diff between matching patches. This is
      a "diff of two diffs", so it can be a bit daunting to read for the
      beginner.
      
      An alternative would be to display an interdiff, i.e. the hypothetical
      diff which is the result of first reverting the old diff and then
      applying the new diff.
      
      Especially when rebasing frequently, an interdiff is often not feasible,
      though: if the old diff cannot be applied in reverse (due to a moving
      upstream), an interdiff can simply not be inferred.
      
      This commit brings `range-diff` closer to feature parity with regard
      to tbdiff.
      
      To make `git range-diff` respect e.g. color.diff.* settings, we have
      to adjust git_branch_config() accordingly.
      
      Note: while we now parse diff options such as --color, the effect is not
      yet the same as in tbdiff, where also the commit pairs would be colored.
      This is left for a later commit.
      
      Note also: while tbdiff accepts the `--no-patches` option to suppress
      these diffs between patches, we prefer the `-s` (or `--no-patch`) option
      that is automatically supported via our use of diff_opt_parse().
      
      And finally note: to support diff options, we have to call
      `parse_options()` such that it keeps unknown options, and then loop over
      those and let `diff_opt_parse()` handle them. After that loop, we have
      to call `parse_options()` again, to make sure that no unknown options
      are left.
      Helped-by: default avatarThomas Gummerer <t.gummerer@gmail.com>
      Helped-by: Eric Sunshine's avatarEric Sunshine <sunshine@sunshineco.com>
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      c8c5e43a
    • Johannes Schindelin's avatar
      range-diff: improve the order of the shown commits · 9dc46e02
      Johannes Schindelin authored
      This patch lets `git range-diff` use the same order as tbdiff.
      
      The idea is simple: for left-to-right readers, it is natural to assume
      that the `git range-diff` is performed between an older vs a newer
      version of the branch. As such, the user is probably more interested in
      the question "where did this come from?" rather than "where did that one
      go?".
      
      To that end, we list the commits in the order of the second commit range
      ("the newer version"), inserting the unmatched commits of the first
      commit range as soon as all their predecessors have been shown.
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      9dc46e02
    • Johannes Schindelin's avatar
      range-diff: first rudimentary implementation · d9c66f0b
      Johannes Schindelin authored
      At this stage, `git range-diff` can determine corresponding commits
      of two related commit ranges. This makes use of the recently introduced
      implementation of the linear assignment algorithm.
      
      The core of this patch is a straight port of the ideas of tbdiff, the
      apparently dormant project at https://github.com/trast/tbdiff.
      
      The output does not at all match `tbdiff`'s output yet, as this patch
      really concentrates on getting the patch matching part right.
      
      Note: due to differences in the diff algorithm (`tbdiff` uses the Python
      module `difflib`, Git uses its xdiff fork), the cost matrix calculated
      by `range-diff` is different (but very similar) to the one calculated
      by `tbdiff`. Therefore, it is possible that they find different matching
      commits in corner cases (e.g. when a patch was split into two patches of
      roughly equal length).
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      d9c66f0b