From: Junio C Hamano Date: Tue, 19 Jul 2016 20:22:12 +0000 (-0700) Subject: Merge branch 'dk/blame-move-no-reason-for-1-line-context' X-Git-Tag: v2.10.0-rc0~114 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7418a6b1a056d076b07087bdd27ad51baebc95e0?ds=inline;hp=-c Merge branch 'dk/blame-move-no-reason-for-1-line-context' "git blame -M" missed a single line that was moved within the file. * dk/blame-move-no-reason-for-1-line-context: blame: require 0 context lines while finding moved lines with -M --- 7418a6b1a056d076b07087bdd27ad51baebc95e0 diff --combined builtin/blame.c index 1e214bd4ec,a3f6874732..2ed83e16b6 --- a/builtin/blame.c +++ b/builtin/blame.c @@@ -56,7 -56,7 +56,7 @@@ static int show_progress static struct date_mode blame_date_mode = { DATE_ISO8601 }; static size_t blame_date_width; -static struct string_list mailmap; +static struct string_list mailmap = STRING_LIST_INIT_NODUP; #ifndef DEBUG #define DEBUG 0 @@@ -134,7 -134,7 +134,7 @@@ struct progress_info int blamed_lines; }; - static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen, + static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, xdl_emit_hunk_consume_func_t hunk_func, void *cb_data) { xpparam_t xpp = {0}; @@@ -142,7 -142,6 +142,6 @@@ xdemitcb_t ecb = {NULL}; xpp.flags = xdl_opts; - xecfg.ctxlen = ctxlen; xecfg.hunk_func = hunk_func; ecb.priv = cb_data; return xdi_diff(file_a, file_b, &xpp, &xecfg, &ecb); @@@ -609,7 -608,7 +608,7 @@@ static struct origin *find_origin(struc } } diff_flush(&diff_opts); - free_pathspec(&diff_opts.pathspec); + clear_pathspec(&diff_opts.pathspec); return porigin; } @@@ -651,7 -650,7 +650,7 @@@ static struct origin *find_rename(struc } } diff_flush(&diff_opts); - free_pathspec(&diff_opts.pathspec); + clear_pathspec(&diff_opts.pathspec); return porigin; } @@@ -980,7 -979,7 +979,7 @@@ static void pass_blame_to_parent(struc fill_origin_blob(&sb->revs->diffopt, target, &file_o); num_get_patch++; - if (diff_hunks(&file_p, &file_o, 0, blame_chunk_cb, &d)) + if (diff_hunks(&file_p, &file_o, blame_chunk_cb, &d)) die("unable to generate diff (%s -> %s)", oid_to_hex(&parent->commit->object.oid), oid_to_hex(&target->commit->object.oid)); @@@ -1129,7 -1128,7 +1128,7 @@@ static void find_copy_in_blob(struct sc * file_p partially may match that image. */ memset(split, 0, sizeof(struct blame_entry [3])); - if (diff_hunks(file_p, &file_o, 1, handle_split_cb, &d)) + if (diff_hunks(file_p, &file_o, handle_split_cb, &d)) die("unable to generate diff (%s)", oid_to_hex(&parent->commit->object.oid)); /* remainder, if any, all match the preimage */ @@@ -1343,7 -1342,7 +1342,7 @@@ static void find_copy_in_parent(struct } while (unblamed); target->suspects = reverse_blame(leftover, NULL); diff_flush(&diff_opts); - free_pathspec(&diff_opts.pathspec); + clear_pathspec(&diff_opts.pathspec); } /* @@@ -2425,7 -2424,8 +2424,7 @@@ static struct commit *find_single_final struct object *obj = revs->pending.objects[i].item; if (obj->flags & UNINTERESTING) continue; - while (obj->type == OBJ_TAG) - obj = deref_tag(obj, NULL, 0); + obj = deref_tag(obj, NULL, 0); if (obj->type != OBJ_COMMIT) die("Non commit %s?", revs->pending.objects[i].name); if (found) @@@ -2460,7 -2460,8 +2459,7 @@@ static char *prepare_initial(struct sco struct object *obj = revs->pending.objects[i].item; if (!(obj->flags & UNINTERESTING)) continue; - while (obj->type == OBJ_TAG) - obj = deref_tag(obj, NULL, 0); + obj = deref_tag(obj, NULL, 0); if (obj->type != OBJ_COMMIT) die("Non commit %s?", revs->pending.objects[i].name); if (sb->final) @@@ -2520,12 -2521,12 +2519,12 @@@ int cmd_blame(int argc, const char **ar enum object_type type; struct commit *final_commit = NULL; - static struct string_list range_list; - static int output_option = 0, opt = 0; - static int show_stats = 0; - static const char *revs_file = NULL; - static const char *contents_from = NULL; - static const struct option options[] = { + struct string_list range_list = STRING_LIST_INIT_NODUP; + int output_option = 0, opt = 0; + int show_stats = 0; + const char *revs_file = NULL; + const char *contents_from = NULL; + const struct option options[] = { OPT_BOOL(0, "incremental", &incremental, N_("Show blame entries as we find them, incrementally")), OPT_BOOL('b', NULL, &blank_boundary, N_("Show blank SHA-1 for boundary commits (Default: off)")), OPT_BOOL(0, "root", &show_root, N_("Do not treat root commits as boundaries (Default: off)")),