Re: [PATCH 03/18] branch-diff: first rudimentary implementation
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- May 3, 2018, 16:30 UTC
- Message-ID
- <24af8d6e-da6f-2d0b-22a0-6a2a215ac55f@ramsayjones.plus.com>
- In-Reply-To
- <ec51c71779a325263c1b705a6b1bfb003fcd528a.1525361419.git.johannes.schindelin@gmx.de>
On 03/05/18 16:30, Johannes Schindelin wrote:
Show 43 quoted lines
> At this stage, `git branch-diff` can determine corresponding commits of
> two related commit ranges. This makes use of the recently introduced
> implementation of the Hungarian algorithm.
>
> The core of this patch is a straight port of the ideas of tbdiff, the
> seemingly 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
> Pythong module `difflib`, Git uses its xdiff fork), the cost matrix
> calculated by `branch-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 <johannes.schindelin@gmx.de>
> ---
> builtin/branch-diff.c | 337 +++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 334 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/branch-diff.c b/builtin/branch-diff.c
> index 97266cd326d..02dc06a57ca 100644
> --- a/builtin/branch-diff.c
> +++ b/builtin/branch-diff.c
> @@ -1,13 +1,17 @@
> #include "cache.h"
> #include "parse-options.h"
> +#include "string-list.h"
> +#include "run-command.h"
> +#include "argv-array.h"
> +#include "hashmap.h"
> +#include "xdiff-interface.h"
> +#include "hungarian.h"
>
> static const char * const builtin_branch_diff_usage[] = {
> N_("git rebase--helper [<options>] ( A..B C..D | A...B | base A B )"),
> NULL
> };
>
> -#define COLOR_DUAL_MODE 2
> -This #define was introduced in the previous patch, without being used in that patch, and is now deleted here.
ATB, Ramsay Jones