{"thread":{"id":"16966","subject":"[TOY PATCH] diffcore-rename: replace basename_same() heuristics by levenshtein","startedAt":"2009-01-02T18:07:56Z","lastAt":"2009-01-02T18:07:56Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"99177","messageId":"alpine.DEB.1.00.0901021301560.27818@racer","threadId":"16966","inReplyTo":null,"subject":"[TOY PATCH] diffcore-rename: replace basename_same() heuristics by levenshtein","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-02T18:07:56Z","receivedAt":"2009-01-02T18:07:56Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhen the environment variable GIT_USE_LEVENSHTEIN is set, the rename\nscore is reduced by the Damerau-Levenshtein distance.  This should\nlead to a little more intuitive rename scores.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tI have this in my personal tree, but I did not really use it.\n\tMaybe others want to play with it.\n\n diffcore-rename.c |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/diffcore-rename.c b/diffcore-rename.c\nindex 168a95b..1f4b371 100644\n--- a/diffcore-rename.c\n+++ b/diffcore-rename.c\n@@ -5,6 +5,7 @@\n #include \"diff.h\"\n #include \"diffcore.h\"\n #include \"hash.h\"\n+#include \"levenshtein.h\"\n \n /* Table of rename/copy destinations */\n \n@@ -187,7 +188,9 @@ static int estimate_similarity(struct diff_filespec *src,\n \tif (!dst->size)\n \t\tscore = 0; /* should not happen */\n \telse\n-\t\tscore = (int)(src_copied * MAX_SCORE / max_size);\n+\t\tscore = (int)(src_copied * MAX_SCORE / max_size)\n+\t\t\t- (getenv(\"GIT_USE_LEVENSHTEIN\") ?\n+\t\t\t   levenshtein(src->path, dst->path, 1, 1, 1, 1) : 0);\n \treturn score;\n }\n \n-- \n1.6.1.rc3.224.g95ac9\n"}]}