{"thread":{"id":"42472","subject":"[PATCH v2] Require 0 context lines in git-blame algorithm","startedAt":"2016-05-28T09:13:53Z","lastAt":"2016-05-28T09:13:53Z","messageCount":1,"participants":["David Kastrup"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"287730","messageId":"1464426833-30406-1-git-send-email-dak@gnu.org","threadId":"42472","inReplyTo":null,"subject":"[PATCH v2] Require 0 context lines in git-blame algorithm","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2016-05-28T09:13:53Z","receivedAt":"2016-05-28T09:13:53Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Previously, the core part of git blame -M required 1 context line.\nThere is no rationale to be found in the code (one guess would be that\nthe old blame algorithm was unable to deal with immediately adjacent\nregions), and it causes artifacts like discussed in the thread\n<http://thread.gmane.org/gmane.comp.version-control.git/255289/>.\n\n<http://permalink.gmane.org/gmane.comp.version-control.git/295795>\nsheds some more light on the history of the previous choice.\n\nSigned-off-by: David Kastrup <dak@gnu.org>\n---\n builtin/blame.c | 7 +++----\n 1 file changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 21f42b0..a3f6874 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -134,7 +134,7 @@ struct progress_info {\n \tint blamed_lines;\n };\n \n-static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,\n+static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b,\n \t\t      xdl_emit_hunk_consume_func_t hunk_func, void *cb_data)\n {\n \txpparam_t xpp = {0};\n@@ -142,7 +142,6 @@ static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,\n \txdemitcb_t ecb = {NULL};\n \n \txpp.flags = xdl_opts;\n-\txecfg.ctxlen = ctxlen;\n \txecfg.hunk_func = hunk_func;\n \tecb.priv = cb_data;\n \treturn xdi_diff(file_a, file_b, &xpp, &xecfg, &ecb);\n@@ -980,7 +979,7 @@ static void pass_blame_to_parent(struct scoreboard *sb,\n \tfill_origin_blob(&sb->revs->diffopt, target, &file_o);\n \tnum_get_patch++;\n \n-\tif (diff_hunks(&file_p, &file_o, 0, blame_chunk_cb, &d))\n+\tif (diff_hunks(&file_p, &file_o, blame_chunk_cb, &d))\n \t\tdie(\"unable to generate diff (%s -> %s)\",\n \t\t    oid_to_hex(&parent->commit->object.oid),\n \t\t    oid_to_hex(&target->commit->object.oid));\n@@ -1129,7 +1128,7 @@ static void find_copy_in_blob(struct scoreboard *sb,\n \t * file_p partially may match that image.\n \t */\n \tmemset(split, 0, sizeof(struct blame_entry [3]));\n-\tif (diff_hunks(file_p, &file_o, 1, handle_split_cb, &d))\n+\tif (diff_hunks(file_p, &file_o, handle_split_cb, &d))\n \t\tdie(\"unable to generate diff (%s)\",\n \t\t    oid_to_hex(&parent->commit->object.oid));\n \t/* remainder, if any, all match the preimage */\n-- \n2.7.4\n"}]}