From: Junio C Hamano Date: Mon, 23 Apr 2012 19:58:22 +0000 (-0700) Subject: Merge branch 'jc/maint-blame-minimal' X-Git-Tag: v1.7.11-rc0~123 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9d76db4e677772fc71d114090076e28c34770261?ds=inline;hp=-c Merge branch 'jc/maint-blame-minimal' "git blame" started missing quite a few changes from the origin since we stopped using the diff minimalization by default in v1.7.2 era. * jc/maint-blame-minimal: blame: accept --need-minimal --- 9d76db4e677772fc71d114090076e28c34770261 diff --combined builtin/blame.c index b35bd6249d,a8d66796bb..324d476abf --- a/builtin/blame.c +++ b/builtin/blame.c @@@ -1828,6 -1828,18 +1828,6 @@@ static int read_ancestry(const char *gr return 0; } -/* - * How many columns do we need to show line numbers in decimal? - */ -static int lineno_width(int lines) -{ - int i, width; - - for (width = 1, i = 10; i <= lines; width++) - i *= 10; - return width; -} - /* * How many columns do we need to show line numbers, authors, * and filenames? @@@ -1868,9 -1880,9 +1868,9 @@@ static void find_alignment(struct score if (largest_score < ent_score(sb, e)) largest_score = ent_score(sb, e); } - max_orig_digits = lineno_width(longest_src_lines); - max_digits = lineno_width(longest_dst_lines); - max_score_digits = lineno_width(largest_score); + max_orig_digits = decimal_width(longest_src_lines); + max_digits = decimal_width(longest_dst_lines); + max_score_digits = decimal_width(largest_score); } /* @@@ -2038,8 -2050,14 +2038,8 @@@ static int git_blame_config(const char return 0; } - switch (userdiff_config(var, value)) { - case 0: - break; - case -1: + if (userdiff_config(var, value) < 0) return -1; - default: - return 0; - } return git_default_config(var, value, cb); } @@@ -2302,6 -2320,7 +2302,7 @@@ int cmd_blame(int argc, const char **ar OPT_BIT('s', NULL, &output_option, "Suppress author name and timestamp (Default: off)", OUTPUT_NO_AUTHOR), OPT_BIT('e', "show-email", &output_option, "Show author email instead of name (Default: off)", OUTPUT_SHOW_EMAIL), OPT_BIT('w', NULL, &xdl_opts, "Ignore whitespace differences", XDF_IGNORE_WHITESPACE), + OPT_BIT(0, "minimal", &xdl_opts, "Spend extra cycles to find better match", XDF_NEED_MINIMAL), OPT_STRING('S', NULL, &revs_file, "file", "Use revisions from instead of calling git-rev-list"), OPT_STRING(0, "contents", &contents_from, "file", "Use 's contents as the final image"), { OPTION_CALLBACK, 'C', NULL, &opt, "score", "Find line copies within and across files", PARSE_OPT_OPTARG, blame_copy_callback },