From: Junio C Hamano Date: Mon, 5 Jun 2017 00:18:10 +0000 (+0900) Subject: Merge branch 'mb/diff-default-to-indent-heuristics' X-Git-Tag: v2.14.0-rc0~110 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/53083f8547cd45cdfabcf2f1bd21461cd6769189?ds=inline;hp=-c Merge branch 'mb/diff-default-to-indent-heuristics' Make the "indent" heuristics the default in "diff" and diff.indentHeuristics configuration variable an escape hatch for those who do no want it. * mb/diff-default-to-indent-heuristics: add--interactive: drop diff.indentHeuristic handling diff: enable indent heuristic by default diff: have the diff-* builtins configure diff before initializing revisions diff: make the indent heuristic part of diff's basic configuration --- 53083f8547cd45cdfabcf2f1bd21461cd6769189 diff --combined builtin/diff-tree.c index 5ea1c14317,36a3a19761..e401112045 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@@ -9,7 -9,7 +9,7 @@@ static struct rev_info log_tree_opt static int diff_tree_commit_sha1(const struct object_id *oid) { - struct commit *commit = lookup_commit_reference(oid->hash); + struct commit *commit = lookup_commit_reference(oid); if (!commit) return -1; return log_tree_commit(&log_tree_opt, commit); @@@ -23,7 -23,7 +23,7 @@@ static int stdin_diff_commit(struct com /* Graft the fake parents locally to the commit */ while (isspace(*p++) && !parse_oid_hex(p, &oid, &p)) { - struct commit *parent = lookup_commit(oid.hash); + struct commit *parent = lookup_commit(&oid); if (!pptr) { /* Free the real parent list */ free_commit_list(commit->parents); @@@ -44,7 -44,7 +44,7 @@@ static int stdin_diff_trees(struct tre struct tree *tree2; if (!isspace(*p++) || parse_oid_hex(p, &oid, &p) || *p) return error("Need exactly two trees, separated by a space"); - tree2 = lookup_tree(oid.hash); + tree2 = lookup_tree(&oid); if (!tree2 || parse_tree(tree2)) return -1; printf("%s %s\n", oid_to_hex(&tree1->object.oid), @@@ -67,7 -67,7 +67,7 @@@ static int diff_tree_stdin(char *line line[len-1] = 0; if (parse_oid_hex(line, &oid, &p)) return -1; - obj = parse_object(oid.hash); + obj = parse_object(&oid); if (!obj) return -1; if (obj->type == OBJ_COMMIT) @@@ -105,9 -105,9 +105,9 @@@ int cmd_diff_tree(int argc, const char struct setup_revision_opt s_r_opt; int read_stdin = 0; + git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ init_revisions(opt, prefix); gitmodules_config(); - git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ opt->abbrev = 0; opt->diff = 1; opt->disable_stdin = 1; diff --combined diff.c index f3546536b4,2c47ccb4a7..48e5f9cb08 --- a/diff.c +++ b/diff.c @@@ -27,7 -27,7 +27,7 @@@ #endif static int diff_detect_rename_default; - static int diff_indent_heuristic; /* experimental */ + static int diff_indent_heuristic = 1; static int diff_rename_limit_default = 400; static int diff_suppress_blank_empty; static int diff_use_color_default = -1; @@@ -290,9 -290,6 +290,6 @@@ int git_diff_ui_config(const char *var return 0; } - if (git_diff_heuristic_config(var, value, cb) < 0) - return -1; - if (!strcmp(var, "diff.wserrorhighlight")) { int val = parse_ws_error_highlight(value); if (val < 0) @@@ -351,6 -348,9 +348,9 @@@ int git_diff_basic_config(const char *v if (starts_with(var, "submodule.")) return parse_submodule_config_option(var, value); + if (git_diff_heuristic_config(var, value, cb) < 0) + return -1; + return git_default_config(var, value, cb); } @@@ -911,7 -911,7 +911,7 @@@ static int fn_out_diff_words_write_help /* * '--color-words' algorithm can be described as: * - * 1. collect a the minus/plus lines of a diff hunk, divided into + * 1. collect the minus/plus lines of a diff hunk, divided into * minus-lines and plus-lines; * * 2. break both minus-lines and plus-lines into words and @@@ -5244,7 -5244,7 +5244,7 @@@ size_t fill_textconv(struct userdiff_dr if (driver->textconv_cache && df->oid_valid) { *outbuf = notes_cache_get(driver->textconv_cache, - df->oid.hash, + &df->oid, &size); if (*outbuf) return size; @@@ -5256,7 -5256,7 +5256,7 @@@ if (driver->textconv_cache && df->oid_valid) { /* ignore errors, as we might be in a readonly repository */ - notes_cache_put(driver->textconv_cache, df->oid.hash, *outbuf, + notes_cache_put(driver->textconv_cache, &df->oid, *outbuf, size); /* * we could save up changes and flush them all at the end,