Re: [PATCH 03/18] branch-diff: first rudimentary implementation
From: Johannes Schindelin <hidden>
Date: 2018-05-03 20:45:09
Hi Ramsay, On Thu, 3 May 2018, Ramsay Jones wrote:
On 03/05/18 16:30, Johannes Schindelin wrote:quoted
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 <redacted> --- 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.
Darn, darn, darn. You know, this macro simply won't die. I tried to kill it off but it keeps showing its ugly head everywhere. I *think* I finally killed it for good. Thanks! Dscho